Skip to main content

Insight · Core Web Vitals & Performance

Define cache runtimes based on file type and change risk.

Immutable versioned files can remain in the cache for extended periods; mutable HTML and API responses require shorter rules and invalidation.

For web developers and website operators, "setting appropriate cache expiration times" can be assessed primarily based on two aspects: "URL stability" and "legacy HTML." This comparison makes the technical boundaries tangible.

Published: 3 min read · Author:

How do you determine cache lifetimes based on file type and change risk?

Immutable, content-hashed files can be stored long-term because every change generates a new URL. HTML and data receive shorter or validating rules according to their business obsolescence risk and the ability to be selectively invalidated.

Consequences of Obsolescence

  1. All delivered content types are classified according to mutability, sensitivity, URL versioning, and user impact.

  2. Browser, CDN, and application rules are defined as a coherent policy for each class, including validation and invalidation.

  3. Tests examine fresh, deprecated, and recalled versions, as well as switching between two deployments.

Invalidation path

  • Cache hit rate and transferred bytes per resource class without mixing private responses.

  • Time until a released change is reliably visible at all relevant cache levels.

URL stability

  • URL stability It is documented whether the content can change under the same address or whether each version receives a new address.

  • Consequences of Obsolescence The permissible duration depends on what a user or process might actually make incorrectly with old content.

  • Invalidation path – Deployment and editorial teams must be able to selectively clear known cache levels or bypass them with a new version.

Practical example: “Old HTML”

A versioned stylesheet is stored immutably for a long time, while the HTML is regularly validated. Upon release, the new document points to a new asset URL; therefore, editorial corrections don't have to wait for the old CSS.

Old HTML

  • Old HTML – A long-cached document can point to incompatible assets or delay urgent content changes.

  • Unnecessary cache clearing – Random query parameters prevent reuse and increase data transfer, even though the file hasn't changed. ...

  • Private replies in shared caches Personalized or authorized content must not be passed to other sessions through inappropriate shared rules.

What to consider when setting appropriate cache durations

An in-depth question answered Effectively Mitigating Render-Blocking CSS FilesHow to mitigate render-blocking CSS files without causing rendering errors?

Further Perspectives Understanding caching plugins instead of installing multiple ones at once.

If you want to practically implement setting appropriate cache durations, you can refer to Robust Website Systems It focuses on "Resources, compression and caching" and "URL stability."

Conclusion: Set Cache Durations Appropriately

Cache duration is a technical indicator of change and obsolescence risk. Versioned assets, documents, and private data therefore require different rules.

Sources and Further Information

The following official documentation and standards provide the technical classification.

Key Thesis

For each resource, the change path, versioning, personalization, and error consequences are evaluated. Fingerprint files receive long runtimes, dynamic responses receive controlled freshness, and targeted deletion is recommended.

What This Is Not About

A uniformly long cache duration for HTML, versioned assets, and dynamic API responses is not a robust caching strategy.

What it's about

Runtimes are determined by mutableness, URL versioning, permissible obsolescence, personalization, and a reliable invalidation path.

More insights

Core Web Vitals & Performance

Consolidating CSS and JavaScript without sacrificing maintainability

"Setting appropriate cache runtimes" includes, as a separate test step, the question: How do you consolidate CSS and JavaScript without losing modular maintainability?

Core Web Vitals & Performance

Optimizing INP when individual interactions are slow

"Setting appropriate cache runtimes" is supplemented by a separate decision: How do you optimize INP when only certain user interactions are slow?

Insights Overview

All VELUNO Insights at a Glance

Further analyses on Website Systems, digital visibility, and robust working models.

Practical Implications

Invalidation path: a specific test point

First, a few real-world response types are categorized as mutable, immutable, and private. For each class, runtime, validation, and invalidation are then tested together.