Skip to content

Instantly share code, notes, and snippets.

@woeterman94
Last active February 10, 2021 16:49
Show Gist options
  • Save woeterman94/06808efa4e618a738327c24f65e43700 to your computer and use it in GitHub Desktop.
Save woeterman94/06808efa4e618a738327c24f65e43700 to your computer and use it in GitHub Desktop.
memorycache
public async Task<IEnumerable<SupplyResponse>> GetSupplyWithCacheAsync()
{
return await _memoryCache.GetOrCreateAsync<IEnumerable<SupplyResponse>>(CacheKeys.ShopSupply, async cache =>
{
cache.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(30);
return await GetWebshopSupply();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment