Client cache-control

Client-side cache control is a feature which value is often underestimated but, if used correctly, represents numerous advantages for end users as well as for web servers. Client-side caching allows to substantially increase the speed of sites navigation and offload the web server, thus lessening bandwidth use and freeing its resources.

The basic aspects of caching are pretty simple. It stores the copy of the loaded page for a specific amount of time (during which it’s considered adequate) allowing user to use it instead of reloading this page from the server. Most of the web clients (browsers) can cache received server responses and store the content on the user’s hard disk drive for further reuse.

To provide efficient caching one should take into consideration two main principles: adequacy and validation. Adequacy means that the cached objects must be up-to-date, i.e. the same as on the server. Validation is an operation to check whether stored data still corresponds to that on the web server. If the data is fresh, the local resource is used, otherwise the data needs to be reloaded from the server.

But by default caching does not provide desired results. This can be easily explained:

Browsers and proxies decide whether to cache given content and for how long to store it based on the parameters set in the HTTP headers of the server response. And by default servers do not set these headers, because actually they do not know what to do with each file and how often this file is changed. When client navigates through the web site, browser sends a request to the server for every page and every linked file on this page, including graphics, CSS, JavaScript files and so on. Even for static files there is If-Modified-Since: - 304 Not Modified client-server collaboration which finally consumes a lot of time.

The goal of client caching is to set some expiration rules for every type of content, so client does not need to reload all site content every time and just uses files from the cache before it expires. Helicon Jet provides you with a separate feature to gracefully control client cache by setting appropriate HTTP server headers. These settings have to be specified manually, but you won’t regret the results!

Helicon Jet allows you to specify expiration time and scope of caching for certain directories and files or content types separately, thus providing subtle adjustment of client cache and therefore increasing server performance.

For implementation instructions and other details, please see Cache control chapter of the current manual.