// helpers protected override void SetCache <TCacheItem>(string cacheKey, TCacheItem result, IQueryOptions <T> queryOptions = null) { try { CachingProvider.Set(cacheKey, result, CacheItemPriority.Default, TimeoutInSeconds); if (queryOptions is IPagingOptions) { CachingProvider.Set(cacheKey + "=>pagingTotal", ((IPagingOptions)queryOptions).TotalItems, CacheItemPriority.Default, TimeoutInSeconds); } } catch (Exception) { // don't let caching errors mess with the repository } }
protected virtual void SetCache <TCacheItem>(string cacheKey, TCacheItem result, IQueryOptions <T> queryOptions = null) { try { CachingProvider.Set(cacheKey, result); if (queryOptions is IPagingOptions) { CachingProvider.Set(cacheKey + "=>pagingTotal", ((IPagingOptions)queryOptions).TotalItems); } //Trace.WriteLine(String.Format("Write item to cache: {0} - {1}", cacheKey, typeof(TCacheItem).Name)); } catch (Exception) { // don't let caching errors mess with the repository } }