Beispiel #1
0
        public T Get <T>(object key)
        {
            T value = default(T);

            ItemPolicyPair pair = null;

            if (Cache.TryGetValue(key, out pair))
            {
                pair.ExpirationPolicy.ItemAccessed(key, pair.Item);
            }

            return(value);
        }
Beispiel #2
0
 public void Put(object key, object item, ICacheExpirationPolicy expirationPolicy)
 {
     expirationPolicy.SetProvider(this);
     Cache[key] = new ItemPolicyPair(item, expirationPolicy);
     expirationPolicy.ItemAdded(key, item);
 }