I am learning the process of caching in Asp.net core and found that we use
- In-memory cache: single server instance
- Distributed cache: when the application is hosted in multiple servers.
I was wondering if we should use distributed cache for a single server application when the size of data to be cached is high. If yes I have another question. What is the size limit where we should switch from in-memory to distributed cache like redis or SQL?
I was trying to know internal mechanism of how in-memory cache is saved within the application to address the above questions. Who is responsible of this cache in .net core framework and how is it handled? Is it the framework that handles this cache? Where exactly is this stored?(in app pool and uses the RAM?) But I found answers to these nowhere and hence my last stop Stack Overflow.
What I think are possibilities?
The in-memory cache extends as needed without any background checks of available RAM for application/s and could cause the crash because of 100% utilisation. Is that correct?
Or is it that whenever cache size exceeds a limit the old cache items are removed automatically? If yes what is that limit and what is it dependent on?
There might be knowledge gaps in the question, please correct me wherever I am wrong in this question.