private void GetProductByCate(HttpContext context, int category, int b, int w, int p = 1) { MapProductDTO(_productSer.GetListByCate(category, b, w), ref PageNumber); if (ListProducts.Count > 0) { string keyCache = $"c{category},b{b},w{w}"; _cache.AddData(keyCache, ListProducts, TimeSpan.FromMinutes(3)); // CookieHelper.AddKeyCache(context, keyCache); ListProducts = GetPage(ListProducts, p); } }
public ICollection <T> GetListItems() { if (_cache == null && _CACHEKEY == null) { return(_db.GetList()); } else { var re = _cache.GetData <List <T> >(_CACHEKEY); if (re == null || re?.Count <= 0) { re = (List <T>)_db.GetList(); if (re == null || re?.Count > 0) { _cache.AddData(_CACHEKEY, re); } } return(re); }; }