ASP.NET Core memory cache

By | 2019-06-25

Response cache is fine for simpler operations, but sometimes you need more fine grained control. System.Runtime.Caching.MemoryCache has builtin support for in-memory cache with expiry.



To register as a service add this to Startup.cs ConfigureServices:


A colleague requested a more complex scenario where we need the cache to update exactly every 1 minute, since numbers from all requests to that particular API should be approximately in sync.

Leave a Reply

Your email address will not be published. Required fields are marked *