public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddMemoryCache();
}
[HttpGet]
public string Get()
{
cache.Set(“MyKey”, DateTime.Now.ToString());
return “This is a test method...”;
}
private IMemoryCache cache;
public MyCacheController(IMemoryCache cache)
{
this.cache = cache;
}