Caching is a technique to speed up the data reading by reusing the same data. It helps to improve the performance since it doesn’t need to fetch data again from origin server.
Good caching techniques support both content providers as well as to content consumers.
There are many types of contents in your applications. Some of them are caching friendly.
Any sensitive information like banking details should not be cached. Or any information which required to change frequently and user specific should not be cached.
When a user requests for a content, server responds back content from origin server and saves a copy of the same content for future requests.
There are different ways caching works:
Browsing caching is the most common type of caching. When ever a content consumer request for a content through a browser, a browser while sending response to consumer saves that data on user device’s hard drive. So, when consumer request for the same data in future browser just load that cached data from user’s system along with some updated data from server. It doesn’t load from the origin server. This makes the browser to load any data quickly even when the internet connection is slow.
When you load a website for the first time, it does not show the cached data. As the cached for the first time remains empty. While serving first time content to the user. Browser makes caching on user’s system of necessary files like CSS, JS, images etc. So, while loading a website for the first time might take time but once it get cached it will load the same data with higher speed.
Browser cache works until the TTL expires or user system’s hard drive is full or until the user clear the cache maually.
Application level caching involves the implementation by developers to insert some caching logic with the base code into the application. So that the processed data can be temporarily stores in memory. Hence, this level reduces the response time of content delivery by application.
Developer have to manually manage the cache. So developers must have the good knowledge of domain on which the application hosted and technology used.