/// <summary>
        ///   Confused re exception thrown here that is not propagated.            
        ///   TODO: BA; exception logging.
        /// </summary>
        bool ICacheImplementation.Add(Key key, object value)
        {
            Ensure.That(key.IsNotNull(), "key not supplied").And(value.IsNotNull(), "value not supplied");

            var success = false;

            try
            {
                if (key.CacheExpirationType == ExpirationType.Absolute)
                {
                    success = DistCache.Add(key.ToString(), value, key.DurationToStore);
                }
                else
                    throw new NotSupportedException("Sliding expirations are not supported by Memcached.");
            }
            catch (Exception e)
            {
                throw;
            }

            return success;
        }
示例#2
0
 /// <summary>
 ///   Removes the item with the specified key from the cache.
 /// </summary>
 public virtual void Remove(Key key)
 {
     _selector.Select(key.DurationToStore, key.StorageStyle, key.CacheExpirationType).Remove(key);
 }
示例#3
0
 /// <summary>
 ///   Does this have any implications for overriding?
 /// </summary>
 object ICachingStrategy.Get(Key key)
 {
     return _selector.Select(key.DurationToStore, key.StorageStyle, key.CacheExpirationType).Get(key);
 }
示例#4
0
 bool ICachingStrategy.Add(Key key, object value)
 {
     return _selector.Select(key.DurationToStore, key.StorageStyle, key.CacheExpirationType)
         .Add(key, value);
 }
        void ICacheImplementation.Remove(Key key)
        {
            Ensure.That(key.IsNotNull(), "key not supplied");

            DistCache.Remove(key.ToString());
        }
        object ICacheImplementation.Get(Key key)
        {
            Ensure.That(key.IsNotNull(), "key not supplied");

            return DistCache.Get(key.ToString());
        }