internal MemoryCacheEntry(string key, object value, DateTimeOffset absExp, TimeSpan slidingExp, CacheItemPriority priority, Collection<ChangeMonitor> dependencies, CacheEntryRemovedCallback removedCallback, MemoryCache cache) : base(key)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     this._utcCreated = DateTime.UtcNow;
     this._value = value;
     this._slidingExp = slidingExp;
     if (this._slidingExp > TimeSpan.Zero)
     {
         this._utcAbsExp = this._utcCreated + this._slidingExp;
     }
     else
     {
         this._utcAbsExp = absExp.UtcDateTime;
     }
     this._expiresEntryRef = System.Runtime.Caching.ExpiresEntryRef.INVALID;
     this._expiresBucket = 0xff;
     this._usageEntryRef = System.Runtime.Caching.UsageEntryRef.INVALID;
     if (priority == CacheItemPriority.NotRemovable)
     {
         this._usageBucket = 0xff;
     }
     else
     {
         this._usageBucket = 0;
     }
     this._callback = removedCallback;
     if (dependencies != null)
     {
         this._fields = new SeldomUsedFields();
         this._fields._dependencies = dependencies;
         this._fields._cache = cache;
     }
 }
Exemplo n.º 2
0
 internal MemoryCacheEntry(string key, object value, DateTimeOffset absExp, TimeSpan slidingExp, CacheItemPriority priority, Collection <ChangeMonitor> dependencies, CacheEntryRemovedCallback removedCallback, MemoryCache cache) : base(key)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     this._utcCreated = DateTime.UtcNow;
     this._value      = value;
     this._slidingExp = slidingExp;
     if (this._slidingExp > TimeSpan.Zero)
     {
         this._utcAbsExp = this._utcCreated + this._slidingExp;
     }
     else
     {
         this._utcAbsExp = absExp.UtcDateTime;
     }
     this._expiresEntryRef = System.Runtime.Caching.ExpiresEntryRef.INVALID;
     this._expiresBucket   = 0xff;
     this._usageEntryRef   = System.Runtime.Caching.UsageEntryRef.INVALID;
     if (priority == CacheItemPriority.NotRemovable)
     {
         this._usageBucket = 0xff;
     }
     else
     {
         this._usageBucket = 0;
     }
     this._callback = removedCallback;
     if (dependencies != null)
     {
         this._fields = new SeldomUsedFields();
         this._fields._dependencies = dependencies;
         this._fields._cache        = cache;
     }
 }