Understanding the components of caching
Before we understand the various possible cache stores/platforms available in .NET 5 applications, we need to understand the various components of caching that are available in .NET 5 and how to use them in enterprise applications. Along the way, we will also cover various cache eviction strategies and techniques to keep the cache in sync with original data stores.
Response caching
Response caching is a caching technique supported by HTTP to cache the response to a request made using HTTP or HTTPS either on the client (for example, browser) or intermediate proxy server. From an implementation standpoint, this is controlled by setting the appropriate value for the Cache-Control
header in both requests and responses. A typical Cache-Control
header will look as follows:
Cache-Control:public,max-age=10
In this case, if the header is present in the response, the server is telling the client/proxy (public) that the client can cache the...