public void UpdateCache(ICache cache) { if (cache == null) { throw new ArgumentNullException("cache"); } cache.Reset(); cache.AddEntity(Execute(new Query <Album>() { QueryType = QueryType.Read, ActionType = ActionType.Select }).Result.ToList()); cache.AddEntity(Execute(new Query <Photo>() { QueryType = QueryType.Read, ActionType = ActionType.Select }).Result.ToList()); cache.AddEntity(Execute(new Query <Tag>() { QueryType = QueryType.Read, ActionType = ActionType.Select }).Result.ToList()); cache.AddEntity(Execute(new Query <PhotoToTag>() { QueryType = QueryType.Read, ActionType = ActionType.Select }).Result.ToList()); cache.AddEntity(Execute(new Query <TextAttributes>() { QueryType = QueryType.Read, ActionType = ActionType.Select }).Result.ToList()); cache.IsActual = true; HttpContext.Current.Cache[CacheKey] = cache; Cache = cache; }
public ISearchResult Search(SearchCriteria criteria) { var key = "LazySearchService"; if (criteria != null) { key += criteria.GetHashCode().ToString(); } if (!cache.ContainsKey(key)) { cache.AddEntity(key, innerService.Search(criteria)); } return(cache.GetEntity(key)); }