public async Task <List <ProjectEntity> > GetProjects(int page = 0, int pageSize = 999) { if (_cacheProvider.TryGet(CacheConstants.SquidexSchemas.Projects, out List <ProjectEntity> items)) { return(items); } items = await _squidexRepo.GetProjects(page, pageSize); _cacheProvider.Set(CacheConstants.SquidexSchemas.Projects, items); return(items); }
public async Task <Project> GetProject(string id) { var projects = await GetItemFromCache(CacheConstants.SquidexSchemas.Projects, () => _repo.GetProjects()); var project = projects.FirstOrDefault(p => p.Id == id); return(_mapper.MapToProject(project)); }