memory cache c# core code example
Example 1: c# .net core memory cache
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddMemoryCache();
}
Example 2: c# .net core memory cache
[HttpGet]
public string Get()
{
cache.Set(“MyKey”, DateTime.Now.ToString());
return “This is a test method...”;
}