in memory cache in .net 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
private IMemoryCache cache;
public MyCacheController(IMemoryCache cache)
{
this.cache = cache;
}