Cache refers to copies of previously accessed Web pages and associated files are stored on a user's computer or on computers operated by an ISP. A cache merely stays between the server (web servers storing websites) and clients (website viewers), and saves copies of data retrieved, such as HTML pages, and images. Now, when the viewer makes a request for the same data again, it can be served from the cache itself instead of making a fresh query to the original server.
Caches can be classified on basis of their levels of operation, as follows:
Browser Caches: The cache setting on your web browser saves content specifically for you. It takes up a portion of your computer's storage to save copies of the pages you have visited. Its functioning is fairly simple - it simply checks whether the page you are requesting has been visited in the current session, since the browser was started.
The functioning of this cache becomes evident when you hit the BACK button in your browser. Notice the difference in the time it takes to load the same (last visited previously) page now, than it did before (on first request).
Proxy Caches: Web proxy caches cater to a large number of users. They are deployed with the aim of reducing network traffic. Proxies serve several users just the way your browser cache serves your purpose. Proxy caches are most useful when it comes to serving the most popular content.
These are often setup by ISPs on their firewalls, and not by the client. For them to function effectively, it is vital that all requests from the clients be retrieved through the proxy. Now, this can be done either by
the clients themselves, by configuring their browsers to look through a particular proxy, or
by the underlying network, storing all responses itself so that the clients do not have to bother with the setup.
Gateway Caches: Gateway caches are also known as reverse proxy caches. These are generally setup by website administrators to improve the performance and reliability of their websites.
Content delivery networks (CDNs) have linked servers throughout the Internet that help reduce network congestion and server overload for content delivered to many users, serving as gateway caches. Akamai is an example of such CDNs.
Caches are used for 2 main reasons:
To reduce loading time for frequently visited websites: When a previously visited page is available in the cache, it serves the page directly - thus taking less time to fulfill the request and display the necessary information. In this way, web sites are loaded much faster.
To decrease network traffic: When a previously stored copy of a website is retrieved instead of a fresh request being made to the server, it helps save on data transfer. This is invaluable, since most hosting companies would charge for data transfer.