/// <summary> /// Gets all cached items /// </summary> public IList <CachedValue <TResult> > GetAll() { var keysToLoad = Keys.ToList(); var results = new List <CachedValue <TResult> >(Keys.Count); foreach (TKey key in Keys) { string itemKey = GetItemKey(key); CacheStrategy <TResult> itemStrategy = new CacheStrategy <TResult>(Cache, itemKey).WithRegion(Region); if (ValidateCallback != null) { itemStrategy = itemStrategy.Validate(ValidateCallback); } CachedValue <TResult> cachedValue = itemStrategy.Get(); if (cachedValue != null) { keysToLoad.Remove(key); results.Add(cachedValue); } } if (RetrieveCallback != null) { ICollection <KeyValuePair <TKey, TResult> > newResults = RetrieveCallback(keysToLoad); foreach (KeyValuePair <TKey, TResult> result in newResults) { string itemKey = GetItemKey(result.Key); TResult value = result.Value; CachedValue <TResult> cachedValue = Cache.Set(itemKey, Region, value, Expiration); results.Add(cachedValue); } } return(results); }