public void Set(string key, CachedRequest val) { if (Interlocked.Increment(ref memoryPressureCounterOnSet) % 25 == 0) // check every 25 sets { TryClearMemory(); } actualCache.AddOrUpdate(key, val, (s, o) => val); lruKeys.Push(key); }
public void Set(string key, CachedRequest val) { if (Interlocked.Increment(ref memoryPressureCounterOnSet) % 25 == 0) // check every 25 sets { TryClearMemory(); } int lastWrite; if (lastWritePerDb.TryGetValue(val.Database, out lastWrite)) { val.ReadTime = lastWrite; } actualCache.AddOrUpdate(key, val, (s, o) => val); lruKeys.Push(key); }
public void Set(string key, T val) { actualCache.AddOrUpdate(key, val, (s, o) => val); lruKeys.Push(key); }