modifiche x evitare se possibile sovrapposizioni in fase lettura/scrittura DB x MP/IO + altro update test BENCH x IO

This commit is contained in:
Samuele E. Locatelli
2017-07-10 11:47:57 +02:00
parent 9cefc371f4
commit 57e52989b4
6 changed files with 81 additions and 100 deletions
+33 -19
View File
@@ -65,8 +65,8 @@ namespace MP_IO.Controllers
}
return answ;
}
// GET BENCH/RSETUP/100
public string RSETUP(int? id)
// GET BENCH/RCLEAN/100
public string RCLEAN(int? id)
{
string answ = "ND";
Stopwatch stopWatch = new Stopwatch();
@@ -88,6 +88,36 @@ namespace MP_IO.Controllers
chiave = string.Format("test:{0}", i);
memLayer.ML.redDelKey(chiave);
}
answ = "OK";
}
catch
{ }
}
stopWatch.Stop();
// Get the elapsed time as a TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
// accodo tempo!
answ += string.Format("<hr/>Elapsed: {0}ms", ts.TotalMilliseconds);
// ritorno
return answ;
}
// GET BENCH/RSETUP/100
public string RSETUP(int? id)
{
string answ = "ND";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// se id nullo --> KO!
if (id == null)
{
answ = "KO";
}
else
{
string chiave;
KeyValuePair<string, string>[] valori = new KeyValuePair<string, string>[2];
try
{
// recupero tutti i record della tabella
// salvo il datasetet come insieme di hash in redis...
@@ -107,7 +137,7 @@ namespace MP_IO.Controllers
// Get the elapsed time as a TimeSpan value.
TimeSpan ts = stopWatch.Elapsed;
// accodo tempo!
answ = string.Format("Elapsed: {0}ms", ts.TotalMilliseconds);
answ += string.Format("<hr/>Elapsed: {0}ms", ts.TotalMilliseconds);
// ritorno
return answ;
}
@@ -129,22 +159,6 @@ namespace MP_IO.Controllers
KeyValuePair<string, string>[] valori = new KeyValuePair<string, string>[2];
try
{
//// svuoto i precedenti hash... CICLO!
//for (int i = 0; i < 1000; i++)
//{
// chiave = string.Format("test:{0}", i);
// memLayer.ML.redDelKey(chiave);
//}
//// recupero tutti i record della tabella
//// salvo il datasetet come insieme di hash in redis...
//for (int i = 0; i < 1000; i++)
//{
// chiave = string.Format("test:{0}", i);
// valori[0] = new KeyValuePair<string, string>("numero", i.ToString());
// valori[1] = new KeyValuePair<string, string>("doppio", (i * 2).ToString());
// memLayer.ML.redSaveHash(chiave, valori);
//}
// ora restituisco record completo dell'hash con ID indicato
chiave = string.Format("test:{0}", id);
valori = memLayer.ML.redGetHash(chiave);