Cache is a mechanism to create multiple copies of the original data and store it in a form such that it can be accessed much faster. Caching is employed in many forms on a website but the primary goal of caching remains the same which is to improve the time required to access information and serve the information faster to the user.
Here are few of the most commonly used caching techniques used for websites:
- Memory Cache: Information frequently accessed can be cached in the faster memory like RAM than using the hard disks to store it. Some of the cache tools used are Memcache or APC which make use of the faster memory to store more frequently accessed information. As an example data stored in the database are typically stored in the database but Memcache or APC cache can keep a snapshot of the database information in the memory cache for frequent read access and as and when the information is written to the database, they update the cache information.
- Disk Cache: Some data which is very frequently read may not be always retrieved from the database but can be accessed via a disk cache. As an example, the HTML of a dynamic website can be stored on the disk instead of retrieving the content stored in the database and rebuilding the complete page’s HTML.
- Browser Cache: All modern web browser deploy a caching mechanism where the content from the website frequently visited by the end user is cache. As an example, if you are viewing a large image from a website, it may take long time for the image to download but subsequent access to the image will be rendered much faster because images aren’t being downloaded again from the web server and are being served from the cache of the browser provided the server has configured to cache such content.