What is Caching

A cache is a device, running software, which is positioned between a set of users who are browsing the Internet and the Internet itself. When a user requests an object or page from the Internet the cache will fetch that object on behalf of the user. So instead of the user request being sent it becomes a request from the cache device itself. This is called Proxying and it significantly enhances the users security because they are effectively cut off from the external world and never get connected directly. All caches are also proxies but not all proxies are caches.

The difference is that a cache will not only fetch the object on behalf of the user it will also store the object locally so that the next time a user requests the same object it will not have to be fetched from the internet at all but simply served at wire speed from the local cache thereby increasing user response time enormously and at the same time saving expensive bandwidth. Actually, it is a little more complex but that is the essence.

The cache also needs to store some parameters about the object in order to ensure that it does not serve a local object to the user when it has changed at the original site. The key parameter is when it expires. Most sites today have an expires header in each page and this is obviously the best method for our software to use to determine whether an object has expired or not but failing that we have various other methods of establishing a reasonable expires parameter. In addition our software has the ability to ask the remote server if an object has changed prior to asking for the object itself.

This is part of the HTTP1.1 standard and if the remote server is compliant (most are today) then, if we have an object in cache but the freshness is in doubt, we can request the object only "if modified since". If not modified then the remote server only needs to send us a very small "not modified" response rather than the entire page or object. This Once again allows us to save bandwidth and improve response times.