public static string GetByMinutes(Guid SiteId, Guid PageId, int CacheMinutes, Dictionary <string, string> querystring, long version = -1) { var hashkey = PageCacheItem.ComputeHash(querystring); var siteitems = GetSiteCaches(SiteId); if (siteitems.ContainsKey(PageId)) { var item = siteitems[PageId]; if (item != null && item.QueryStringHash == hashkey) { // force update when page version change. if (version > 0 && item.Version != version) { return(null); } // by minutes var MinutesPast = DateTime.Now - item.LastModify; if (MinutesPast.Minutes < CacheMinutes) { return(item.Result); } } } return(null); }
public static string GetByVersion(Guid SiteId, Guid PageId, long Version, Dictionary <string, string> querystring = null) { var hashkey = PageCacheItem.ComputeHash(querystring); var siteitems = GetSiteCaches(SiteId); if (siteitems.ContainsKey(PageId)) { var item = siteitems[PageId]; if (item != null && item.QueryStringHash == hashkey) { // by version. if (Version == item.Version) { return(item.Result); } } } return(null); }