Пример #1
0
        /// <summary>
        /// 以键取值
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="key">键</param>
        /// <returns>值</returns>
        public static T Get <T>(string key)
        {
            WrapCacheConfigItem _cacheConfig = CacheConfigContext.GetCurrentWrapCacheConfigItem(key);

            return(_cacheConfig.CacheProvider.Get <T>(key));
        }
Пример #2
0
        /// <summary>
        /// 移除
        /// </summary>
        /// <param name="key">键</param>
        public static void Remove(string key)
        {
            WrapCacheConfigItem _cacheConfig = CacheConfigContext.GetCurrentWrapCacheConfigItem(key);

            _cacheConfig.CacheProvider.Remove(key);
        }
Пример #3
0
        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        public static void Set(string key, object value)
        {
            WrapCacheConfigItem _cacheConfig = CacheConfigContext.GetCurrentWrapCacheConfigItem(key);

            _cacheConfig.CacheProvider.Set(key, value, _cacheConfig.CacheConfigItem.Minitus, _cacheConfig.CacheConfigItem.IsAbsoluteExpiration);
        }