Example #1
0
        /// <summary>
        /// 删除缓存
        /// </summary>
        private void RefreshCacheRemove()
        {
            var list =
                GlobalCacheWrapper.GetData("G_CommodityPromotion:" + AppId, CommodityId.ToString(), CacheTypeEnum.redisSS,
                                           "BTPCache") as List <TodayPromotionDTO>;

            if (list == null || !list.Any())
            {
                return;
            }
            list.RemoveAll(c => c.Id == Id);
            GlobalCacheWrapper.Add("G_CommodityPromotion:" + AppId, CommodityId.ToString(), list, CacheTypeEnum.redisSS, "BTPCache");
        }
Example #2
0
        /// <summary>
        /// 向商品详情缓存中增加Cache
        /// </summary>
        private void ResfreshCacheAdd()
        {
            if (StartTime >= DateTime.Today.AddDays(1) || EndTime <= DateTime.Today || StartTime >= EndTime)
            {
                return;
            }
            var list =
                GlobalCacheWrapper.GetData("G_CommodityPromotion:" + AppId, CommodityId.ToString(), CacheTypeEnum.redisSS,
                                           "BTPCache") as List <TodayPromotionDTO> ?? new List <TodayPromotionDTO>();

            list.Add(ToEntityData());
            GlobalCacheWrapper.Add("G_CommodityPromotion:" + AppId, CommodityId.ToString(), list, CacheTypeEnum.redisSS, "BTPCache");
        }