private static void RunThreadPersistancCacheTest(IEnumerable <CacheItem> items, int threadNo) { var stopwatch = new Stopwatch(); var cacheHits = 0; var cacheMiss = 0; var exceptions = 0; var storageExceptions = 0; var count = 0; long lastInterval = 0; stopwatch.Start(); foreach (var item in items) { count++; PersistentCache.CacheItem value; if (PersistentCache.TryGet(item.Key, out value)) { cacheHits++; } else { cacheMiss++; PersistentCache.Put(item.Key, item.Value); if (!PersistentCache.TryGet(item.Key, out value)) { exceptions++; } } if (value.Value != item.Value.Value) { storageExceptions++; } if (count % 1000 == 0) { Console.WriteLine("Thread: {0} :: {1} processed ... {2}ms", threadNo, count, lastInterval == 0 ? stopwatch.ElapsedMilliseconds : stopwatch.ElapsedMilliseconds - lastInterval); lastInterval = stopwatch.ElapsedMilliseconds; } } stopwatch.Stop(); Console.WriteLine("Threa: {5} :: Test run in {0}ms, with {1} hits and {2} misses, exceptions {3} and storage exceptions {4}", stopwatch.ElapsedMilliseconds, cacheHits, cacheMiss, exceptions, storageExceptions, threadNo); }