protected AbstractEvictingCache(IManagedCache <TKey, TValue> parent, int capacity) { if (capacity <= 0) { throw new ArgumentOutOfRangeException("capacity", "must be strictly greater than zero"); } Parent = parent; }
public void Delete(IManagedCache cache) { for (int i = 0; i < cache.MaxStair; i++) { cache.Clear(i, 0); } _ManagedCacheList.Remove(cache); }
internal void Add(IManagedCache cache) { lock (_LockObj) { _CacheAdded = true; _ManagedCacheList.Add(cache); _MaxStair = Math.Max(_MaxStair, cache.MaxStair); } }
public MemorySubCache(IManagedCache <TKey, TValue> parent, int capacity) : base(parent, capacity) { if (parent == null) { throw new ArgumentNullException("parent", "cannot be null"); } this.capacity = capacity; }
public static void UnRegister(IManagedCache managedCache) { lock (_LockObj) { if (_CacheToReduceTimes.ContainsKey(managedCache)) { _CacheToReduceTimes.Remove(managedCache); } } }
public static void Register(IManagedCache managedCache) { lock (_LockObj) { if (!_CacheToReduceTimes.ContainsKey(managedCache)) { _CacheToReduceTimes.Add(managedCache, 0); } } }
public static bool IsLastUpdatedTimeDifferent(this IManagedCache managedCache, CacheUpdateEvent cacheUpdateEvent) { bool isDifferent; if (cacheUpdateEvent.UpdatedTimeString == null) { isDifferent = managedCache.LastUpdatedAt != DateTimeOffset.MinValue; } else { isDifferent = managedCache.LastUpdatedAt.ToString() != cacheUpdateEvent.UpdatedTimeString; } return(isDifferent); }
private IManagedCache SetupCache(IManagedCache cache) { cache.CacheInvalidated += OnCacheInvalidated; cache.CacheUpdated += OnCacheUpdated; return(cache); }