public static DataSet GetPageViewCache <D, T, Key>(this BizBase <D, T, Key> objBizBase, string dependencyKey, bool isCache, TimeSpan expiry, string condition, MySqlParameter[] parms, string sortExpression, int pageSize, int pageIndex, out int recordCount, string fields = "*") where D : DalBase <T, Key> where T : class, new() { dependencyKey = objBizBase.GetDependencyKey <D, T, Key>(dependencyKey); string cacheKey = string.Concat(new object[] { objBizBase.Dal.TableViewName.ToLower(), "Page", GetCondtiionParam(condition, parms), sortExpression, pageSize, pageIndex, fields }).Replace(" ", "").ToLower(); if (isCache) { PageCache dependencyCache = cacheKey.GetDependencyCache <PageCache>(dependencyKey); if (dependencyCache != null) { recordCount = dependencyCache.RecordCount; return(dependencyCache.Data); } DataSet set = objBizBase.GetPageView(condition, parms, sortExpression, pageSize, pageIndex, out recordCount, fields); new PageCache { RecordCount = recordCount, Data = set }.SetDependencyCache(dependencyKey, cacheKey, expiry); return(set); } DeleteCacheKey(MemcacheCacheHelper.CreateDependencyCacheKey(dependencyKey, cacheKey)); return(objBizBase.GetPageView(condition, parms, sortExpression, pageSize, pageIndex, out recordCount, fields)); }
public static IList <T> GetPageListFieldsCache <D, T, Key>(this BizBase <D, T, Key> objBizBase, string dependencyKey, bool isCache, TimeSpan expiry, string condition, MySqlParameter[] parms, int pageSize, int pageIndex, out int recordCount, string fields, string sortExpression = "") where D : DalBase <T, Key> where T : class, new() { dependencyKey = objBizBase.GetDependencyKey <D, T, Key>(dependencyKey); string cacheKey = string.Concat(new object[] { objBizBase.Dal.TableName.ToLower(), "PageListCount", GetCondtiionParam(condition, parms), sortExpression, pageSize, pageIndex, string.IsNullOrWhiteSpace(fields) ? "" : fields }).Replace(" ", "").ToLower(); if (isCache) { PageCache <T> dependencyCache = cacheKey.GetDependencyCache <PageCache <T> >(dependencyKey); if (dependencyCache != null) { recordCount = dependencyCache.RecordCount; return(dependencyCache.Data); } dependencyCache = new PageCache <T> { Data = objBizBase.GetPageListFields(condition, parms, sortExpression, pageSize, pageIndex, out recordCount, fields), RecordCount = recordCount }; dependencyCache.SetDependencyCache(dependencyKey, cacheKey, expiry); return(dependencyCache.Data); } DeleteCacheKey(MemcacheCacheHelper.CreateDependencyCacheKey(dependencyKey, cacheKey)); return(objBizBase.GetPageListFields(condition, parms, sortExpression, pageSize, pageIndex, out recordCount, fields)); }