// set timestamp and do other background processing such as expiration & removal of old Entries... private void AddTimeStamp(CacheKey key, CacheEntryBase cacheEntry, bool callOnIdle = true) { if (cacheEntry == null || cacheEntry.NonExpiring) { if (callOnIdle) { MethodOnIdle(); } return; } lock (_addBatch) { _addBatch.Add(new KeyValuePair <CacheKey, CacheEntryBase>(key, cacheEntry)); } if (callOnIdle) { MethodOnIdle(); } }
private void UpdateTimeStamp(CacheKey key, CacheEntryBase cacheEntry, long newTimeStamp, bool callOnIdle = true) { if (cacheEntry.NonExpiring) { if (callOnIdle) { MethodOnIdle(); } return; } lock (_updateBatch) { _updateBatch.Add(new UpdateEntry(key.TimeStamp, newTimeStamp, new CacheEntryReference(cacheEntry) { CacheEntryKey = key.Key })); } if (callOnIdle) { MethodOnIdle(); } }
public CacheEntryReference(CacheEntryBase other) : base(other) { }
public CacheEntryBase(CacheEntryBase source) { SlidingExpiration = source.SlidingExpiration; ExpirationTime = source.ExpirationTime; Priority = source.Priority; }