Reputation: 1057
I am writing a .NET Core based WebAPI. I want to utilize a Distributed Memory Cache for my development environment by registering an IDistributedCache in Startup.ConfigureServices.
public void ConfigureServices(IServiceCollection services)
{
if (_hostContext.IsDevelopment())
{
services.AddDistributedMemoryCache();
}
else
{
services.AddDistributedRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "SampleInstance";
});
}
}
However, I dont want the data caching to eat up most of my RAM. How can I limit the DistributedMemoryCache to use only 2GIG for example?
Upvotes: 2
Views: 2274