Beispiel #1
0
 // 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();
     }
 }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
 public CacheEntryReference(CacheEntryBase other) : base(other)
 {
 }
Beispiel #4
0
 public CacheEntryBase(CacheEntryBase source)
 {
     SlidingExpiration = source.SlidingExpiration;
     ExpirationTime    = source.ExpirationTime;
     Priority          = source.Priority;
 }