Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What does a repository look like when using many 1:Many or Many:Many tables?
- namespace MVCAzureStore.Services.Caching
- {
- public class CachedProductsRepository : CachedDataSource, IProductRepository
- {
- private readonly IProductRepository repository;
- public CachedProductsRepository(IProductRepository repository, ObjectCache cacheProvider) :
- base(cacheProvider, "Products")
- {
- this.repository = repository;
- }
- public List<string> GetProducts()
- {
- return RetrieveCachedData(
- "allproducts", () => this.repository.GetProducts(),
- new CacheItemPolicy { AbsoluteExpiration = DateTime.UtcNow.AddMinutes(1) });
- }
- }
- }
Add Comment
Please, Sign In to add comment