I want to use Session in ASP.NET MVC CORE 1.1 but a bit confused.
What is the difference between:
services.AddDistributedMemoryCache(); vs services.AddMemoryCache();
It also looks like Session works without both of them, how come?
I want to use Session in ASP.NET MVC CORE 1.1 but a bit confused.
What is the difference between:
services.AddDistributedMemoryCache(); vs services.AddMemoryCache();
It also looks like Session works without both of them, how come?
Copyright © 2021 Jogjafile Inc.
services.AddMemoryCache();
which represents a cache stored in the memory of the local web server.
services.AddDistributedMemoryCache();
which represents a cache shared by multiple app servers. The information in the cache is not stored in the memory of individual web servers, and the cached data is available to all of the app's servers. In this, you can configure both Redis and SQL Server distributed caches.
For more info, refer these links-
https://learn.microsoft.com/en-us/aspnet/core/performance/caching/memory https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed