using Microsoft.Extensions.Caching.Memory;
if (_memoryCache.TryGetValue("IME MEMORY CACHE", out var STA CUVAMO))
{
return STA CUVAMO;
}
else
{
STA CUVAMO = await _Provider.GetAsync();
//VREME KOLIO CUVAMO TRECI PARAMETAR
_memoryCache.Set("IME MEMORY CACHE", STA CUVAMO, TimeSpan.FromHours(8));
return STA CUVAMO;
}
// U PROGRAM CS
builder.Services.AddMemoryCache();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter