/// <summary> /// 根据产品ID获取Tag列表 /// </summary> /// <param name="productTag"></param> /// <returns></returns> public static List <Tag> GetTagsByProduct(int productID, bool cacheable) { List <Tag> tags = null; string tagsCacheKey = CacheKeyManager.GetTagProductKey(productID); if (HttpContext.Current != null) { tags = HttpContext.Current.Items[tagsCacheKey] as List <Tag>; } if (tags != null) { return(tags); } if (cacheable) { tags = HHCache.Instance.Get(tagsCacheKey) as List <Tag>; } if (tags == null) { tags = CommonDataProvider.Instance.GetTagsByProduct(productID); //缓存 if (cacheable) { HHCache.Instance.Insert(tagsCacheKey, tags, 1); } if (HttpContext.Current != null) { HttpContext.Current.Items[tagsCacheKey] = tags; } } return(tags); }
/// <summary> /// 更新产品Tag(tagList使用;分隔) /// </summary> /// <param name="productID"></param> /// <param name="tagList"></param> public static void UpdateTagProduct(int productID, string tagList) { CommonDataProvider.Instance.UpdateTagProduct(productID, tagList); HHCache.Instance.Remove(CacheKeyManager.GetTagProductKey(productID)); HHCache.Instance.Remove(CacheKeyManager.GetTagKey()); }