示例#1
0
        /// <summary>
        /// Adds an object to the cache and uses generic type.
        /// </summary>
        /// <param name="timeout">Time the object should be kept, after which it can be disposed.</param>
        /// <param name="key">Key which will be used to retrieve the same object.</param>
        /// <param name="value">The instance of the object that should be stored in cache.</param>
        public void Add <T>(TimeSpan timeout, string key, T value)
        {
            Asserter.AssertIsNotNullOrEmptyString("key", key);
            Asserter.AssertIsNotNull("value", value);

            LocalCacheStorage.Add(key, value);
        }
示例#2
0
        /// <summary>
        /// Adds an object to the cache. It is upto the implementer on how long it wishes to keep the item in cache.
        /// Typically it will be govered by the TimeToExpire property being set.
        /// </summary>
        /// <param name="key">Key which will be used to retrieve the same object.</param>
        /// <param name="value">The instance of the object that should be stored in cache.</param>
        public void Add(string key, object value)
        {
            Asserter.AssertIsNotNullOrEmptyString("key", key);
            Asserter.AssertIsNotNull("value", value);

            LocalCacheStorage.Add(key, value);
        }