private static void RunCacheCommands(int poolSize) { MemcachedInstances mi = new MemcachedInstances(poolSize, Common.Properties.MainCacheServerIPEndPoints); MemcachedClient mc = new MemcachedClient(mi, new SHA1Hasher()); int numRuns = 10000; DateTime start = DateTime.Now; bool threadRunning = false; object threadRunningLock = new object(); for (int i = 0; i < numRuns; i++) { lock (threadRunningLock) { threadRunning = true; } new Thread(() => { string key = Guid.NewGuid().ToString(); mc.Store(key, key, DateTime.MaxValue); mc.Get(key); mc.BlockingDelete(key); lock (threadRunningLock) { threadRunning = false; } }).Start(); } while (threadRunning) { Thread.Sleep(100); } Console.WriteLine(); TimeSpan duration = DateTime.Now - start; Console.WriteLine("Pool size: {0}, duration: {1} seconds", poolSize.ToString().PadLeft(3), duration.TotalMilliseconds.ToString()); }
public static void RefreshServers() { mainMemcachedInstances = new MemcachedInstances(maximumSizeOfConnectionPool, Common.Properties.MainCacheServerIPEndPoints); viewStateMemcachedInstances = new MemcachedInstances(maximumSizeOfConnectionPool, Common.Properties.ViewStateCacheServerIPEndPoints); }
public CommandExecuter(MemcachedInstances instances) { this.instances = instances; }
public MemcachedClient(MemcachedInstances instances, IHasher hasher) { this.instances = instances; this.hasher = hasher; }