public Item GetById(int id) { IList <Item> items; if (CacheWrapper.Exists(cacheKey)) { CacheWrapper.Get(cacheKey, out items); } else { items = _items; } return(items.FirstOrDefault(i => i.Id.Equals(id))); }
public IList <Item> GetAll() { IList <Item> retVal; if (CacheWrapper.Exists(cacheKey)) { CacheWrapper.Get(cacheKey, out retVal); } else { retVal = _items; CacheWrapper.Add(retVal, cacheKey, DateTimeOffset.UtcNow.AddMinutes(1)); } return(retVal); }