asp.net core memory cache example
Example 1: c# .net core memory cache
[HttpGet]
public string Get()
{
cache.Set(“MyKey”, DateTime.Now.ToString());
return “This is a test method...”;
}
Example 2: c# .net core memory cache
private IMemoryCache cache;
public MyCacheController(IMemoryCache cache)
{
this.cache = cache;
}