Пример #1
0
        public List <FilterEntity> RefreshCouponCache()
        {
            List <FilterEntity>     orderFilterlist = BusinessService.GetAllFilter();
            ICacheItemRefreshAction refreshAction   = new FilterCacheRefreshAction();

            CacheHelper.Add(ConstantDataManager.CouponCacheKey, orderFilterlist, refreshAction, ConstantDataManager.GetExpiredSeconds(), true);

            return(GetAllOrderFilterForCoupon());
        }
Пример #2
0
        /// <summary>
        /// 自定义刷新操作
        /// </summary>
        /// <param name="removedKey">移除的键</param>
        /// <param name="expiredValue">过期的值</param>
        /// <param name="removalReason">移除理由</param>
        void ICacheItemRefreshAction.Refresh(string removedKey, object expiredValue, CacheItemRemovedReason removalReason)
        {
            if (removalReason == CacheItemRemovedReason.Expired)
            {
                List <FilterEntity> orderFilterlist = BusinessService.GetAllFilter();

                ICacheItemRefreshAction refreshAction = new FilterCacheRefreshAction();
                CacheHelper.Add(removedKey, orderFilterlist, refreshAction, ConstantDataManager.GetExpiredSeconds(), true);
            }
        }
Пример #3
0
        /// <summary>
        /// 从缓存中获取配置参数
        /// </summary>
        /// <returns></returns>
        public List <FilterEntity> GetAllOrderFilterForCoupon()
        {
            var cacheValue = CacheHelper.GetCache(ConstantDataManager.CouponCacheKey);

            if (!CacheHelper.ContainsKey(ConstantDataManager.CouponCacheKey))
            {
                List <FilterEntity>     orderFilterlist = BusinessService.GetAllFilter();
                ICacheItemRefreshAction refreshAction   = new FilterCacheRefreshAction();
                CacheHelper.Add(ConstantDataManager.CouponCacheKey, orderFilterlist, refreshAction, ConstantDataManager.GetExpiredSeconds(), true);

                return(orderFilterlist);
            }
            else
            {
                return(cacheValue as List <FilterEntity>);
            }
        }