Why getting multiple instances of IMemoryCache in ASP.Net Core?
问题 I have what I believe is a standard usage of IMemoryCache in my ASP.NET Core application. In startup.cs I have: services.AddMemoryCache(); In my controllers I have: private IMemoryCache memoryCache; public RoleService(IMemoryCache memoryCache) { this.memoryCache = memoryCache; } Yet when I go through debug, I end up with multiple memory caches with different items in each one. I thought memory cache would be a singleton? Updated with code sample: public List<FunctionRole> GetFunctionRoles() {