internal CacheItem(object key, object value, CacheKeyDependency dependency)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     this._key                = key;
     this._value              = value;
     this._removedReason      = ObjectCacheItemRemovedReason.Underused;
     this._dateCreated        = DateTime.UtcNow;
     this._absoluteExpiration = this._dateCreated.AddSeconds(300.0);
     this._dependency         = dependency;
     this._callback           = null;
 }
Ejemplo n.º 2
0
 internal CacheItem(object key, object value, CacheKeyDependency dependency)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     this._key = key;
     this._value = value;
     this._removedReason = ObjectCacheItemRemovedReason.Underused;
     this._dateCreated = DateTime.UtcNow;
     this._absoluteExpiration = this._dateCreated.AddSeconds(300.0);
     this._dependency = dependency;
     this._callback = null;
 }
        public void Add(object key, object value, DateTime absoluteExpiration, ICacheDependency dependency, ObjectCacheItemRemovedCallback callback)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            CacheItem item = this.Wrap(key, value);

            if (absoluteExpiration != DateTime.MaxValue)
            {
                item.AbsoluteExpiration = absoluteExpiration.AddSeconds(-1.0);
            }
            if (dependency != null)
            {
                item.Dependency = dependency;
            }
            if (callback != null)
            {
                item.Callback = callback;
            }
            this.Add(item);
        }
Ejemplo n.º 4
0
 public void Add(object key, object value, DateTime absoluteExpiration, ICacheDependency dependency, ObjectCacheItemRemovedCallback callback)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     CacheItem item = this.Wrap(key, value);
     if (absoluteExpiration != DateTime.MaxValue)
     {
         item.AbsoluteExpiration = absoluteExpiration.AddSeconds(-1.0);
     }
     if (dependency != null)
     {
         item.Dependency = dependency;
     }
     if (callback != null)
     {
         item.Callback = callback;
     }
     this.Add(item);
 }