Skip to content

Instantly share code, notes, and snippets.

@umayeras
Created October 14, 2020 12:36
Show Gist options
  • Save umayeras/07d2556a08a6d769b90652d295017e81 to your computer and use it in GitHub Desktop.
Save umayeras/07d2556a08a6d769b90652d295017e81 to your computer and use it in GitHub Desktop.
public async Task<IEnumerable<Sample>> GetAll()
{
if (cachingService.Exists(CacheKey.Samples))
{
return cachingService.Get<IEnumerable<Sample>>(CacheKey.Samples);
}
var list = await repository.GetAllAsync();
cachingService.Set(CacheKey.Samples, samples.ToList());
return list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment