public CacheService() { if (Environment.OSVersion.Version.Major >= 6) //windows 7 or above? _workingSetCounter = new PerformanceCounter("Process", "Working Set - Private", Process.GetCurrentProcess().ProcessName); else _workingSetCounter = new PerformanceCounter("Process", "Working Set", Process.GetCurrentProcess().ProcessName); _localCache = new ConcurrentDictionary<string, ServerCacheItem>(Environment.ProcessorCount * 2, 1000); _evictor = new Evictor(_localCache); NodeState = NodeState.WaitingForNeighbourNode; //need to check if we recieve any information from neighbours in next 6 seconds. //such that they can move their data to me. note that default state is 'WaitingForOtherNode' heartBeatResetter = new Timer(TimerCallbackHeartBeatReset, null, 7000, Timeout.Infinite); _cacheItemRelocator = new CacheItemRelocator(_localCache); Trace.WriteLine("Initialized cacheService"); }
public CacheService() { if (Environment.OSVersion.Version.Major >= 6) //windows 7 or above? { _workingSetCounter = new PerformanceCounter("Process", "Working Set - Private", Process.GetCurrentProcess().ProcessName); } else { _workingSetCounter = new PerformanceCounter("Process", "Working Set", Process.GetCurrentProcess().ProcessName); } _localCache = new ConcurrentDictionary <string, ServerCacheItem>(Environment.ProcessorCount * 2, 1000); _evictor = new Evictor(_localCache); NodeState = NodeState.WaitingForNeighbourNode; //need to check if we recieve any information from neighbours in next 6 seconds. //such that they can move their data to me. note that default state is 'WaitingForOtherNode' heartBeatResetter = new Timer(TimerCallbackHeartBeatReset, null, 7000, Timeout.Infinite); _cacheItemRelocator = new CacheItemRelocator(_localCache); Trace.WriteLine("Initialized cacheService"); }