private static int RunMixedPackTest(ITestClient testClient, int loopSize, string key1, string key2, bool flushdb = true) { using (testClient) { var payload = Payloads.MediumPayload; testClient.Connect(_cs); if (flushdb) { testClient.FlushDb(); } var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < loopSize; i++) { testClient.SetAsync(key1, payload); testClient.IncrAsync(key2); } var result = testClient.GetString(key1); var incrResult = testClient.GetInt(key2); if (result != payload) { Console.Write("[condition failed Result == Payload] "); } if (incrResult != loopSize) { Console.Write("[condition failed IncrResult == LoopSize] "); } sw.Stop(); return((int)sw.ElapsedMilliseconds); } }
private static int RunBasicTest(ITestClient testClient, string payload, int loopSize) { using (testClient) { testClient.Connect(_cs); testClient.FlushDb(); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < loopSize; i++) { testClient.SetAsync(KeyName, payload); } var result = testClient.GetString(KeyName); if (result != payload) { Console.Write("[condition failed Result == Payload] "); } sw.Stop(); return((int)sw.ElapsedMilliseconds); } }
private static int RunSyncExecutionTest(string payload, ITestClient testClient, int loopSize) { using (testClient) { testClient.Connect(_cs); testClient.FlushDb(); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < loopSize; i++) testClient.Set(KeyName, payload); var result = testClient.GetString(KeyName); if (result != payload) Console.Write("[condition failed Result == Payload] "); sw.Stop(); return (int)sw.ElapsedMilliseconds; } }
private static int RunMixedPackTest(ITestClient testClient, int loopSize, string key1, string key2, bool flushdb = true) { using (testClient) { var payload = Payloads.MediumPayload; testClient.Connect(_cs); if (flushdb) testClient.FlushDb(); var sw = new Stopwatch(); sw.Start(); for (var i = 0; i < loopSize; i++) { testClient.SetAsync(key1, payload); testClient.IncrAsync(key2); } var result = testClient.GetString(key1); var incrResult = testClient.GetInt(key2); if (result != payload) Console.Write("[condition failed Result == Payload] "); if (incrResult != loopSize) Console.Write("[condition failed IncrResult == LoopSize] "); sw.Stop(); return (int) sw.ElapsedMilliseconds; } }