Caching is the key to optimum website performance. This article describes how you can make sure that your website uses the freistilbox content cache as efficiently as possible.
Website content will only be cached if the HTTP headers it gets delivered with allow it.
In the following cases content can not be cached:
- Your website sends HTTP headers that actively prohibit caching (for example, “
- Your website sends HTTP headers that make the content individual in any way (for example, cookies)
If your website allows the content for a certain request to be cached, the caching server will deliver this content until it expires. The duration for which cached content gets stored and delivered depends again on certain HTTP headers.
The most important header is “Cache-control”. It can contain the value “max-age” which defines how many seconds certain content may be stored in the cache. For example, a value of “max-age=300” means that the cache content will expire after 5 minutes (300s).
In order to test how effectively your website’s content is getting cached, you check its HTTP headers.
There are many tools that help you check the HTTP headers of your content. Most current web browsers offer “developer tools” that will display the header information.
Alternatively, you can use the command line:
curl -I http://www.example.com/
This is the most important aspect in terms of caching because as soon as content looks “individual” to the caching server, it will not be cached.
The most common cause of “individualisation” is cookies. If content comes with a cookie, it’s obviously meant for this single visitor, so caching it for later requests makes almost no sense.