Skip to content
SilktideHelp

Efficient caching

Silktide loads your pages in a real browser and checks how long each file may be kept by the visitor's browser before it must be downloaded again. Files that are kept for only a short time, or not at all, are reported along with the data that repeat visitors download unnecessarily.

Why this matters

Most of a website's files barely change: logos, stylesheets, scripts, and fonts are the same on every page and every visit. When a browser is allowed to them, a returning visitor loads them instantly from their own device instead of downloading them again. Without caching, every page view starts from scratch - repeat visits feel as slow as the first, and your visitors and servers pay for the same bytes over and over.

How to fix it

  1. Configure your server to send a long cache lifetime for static files - a year is common:
# Response header for static files (1 year)
Cache-Control: max-age=31536000, immutable
  1. Solve the update problem with versioned URLs: when a file changes, change its URL (for example app.3f2a1.css). Browsers treat the new URL as a new file, so long caching never serves stale content. Most build tools and can do this automatically.
  2. Keep short or no caching for content that must always be fresh, such as the of the page itself.

How Silktide tests this

  1. Load the page in a real browser and read the caching instructions each file was served with.
  2. Identify static files - such as images, stylesheets, scripts, and fonts - whose cache lifetime is short or missing.
  3. Report each file with its current cache lifetime and size, weighted by how likely it is that a repeat visit would re-download it.

Troubleshooting

We change these files often

That is what versioned URLs are for: cache forever, and change the URL when the content changes. If your platform can't version URLs, pick the longest lifetime you can tolerate staleness for - even a day is far better than nothing.

Third-party files are reported

Cache lifetimes are set by the server that delivers the file, so you can't fix caching for another company's scripts. You can weigh whether the service is worth the cost - see 3rd party code.

Learn more

Last updated

Was this page helpful?

Efficient caching | Silktide Help