GitHub

Weak Caching (site-wide)

Flags sites where most pages lack caching freshness, validators, or compression

Flags sites where most pages lack caching freshness, validators, or compression.

Rule IDperf/bad-caching
CategoryPerformance
ScopeSite-wide
Severitywarning
Weight5/10

What it checks

Where perf/cache-headers and perf/compression report per page, this rule looks at the whole site and flags systemic weakness — caching mistakes that cost you on every repeat visit and behind every CDN. Across all crawled HTML responses it measures the fraction of pages that:

  • declare a caching freshness lifetime (Cache-Control: max-age/s-maxage or Expires, and not no-store),
  • expose a validator (ETag or Last-Modified) for cheap revalidation, and
  • serve compressible bodies with gzip/Brotli/zstd compression.

Each dimension reports pass/warn/fail with the ratio and example pages.

Solution

Set Cache-Control with an appropriate max-age on every response (short for HTML, long + immutable for hashed static assets), expose an ETag or Last-Modified for cheap revalidation, and enable gzip/Brotli for text responses. Consistent caching across the whole site cuts repeat-visit load times and origin/CDN cost.

Options

This rule supports the following configuration options:

OptionTypeDefaultDescription
min_freshness_rationumber0.6Minimum fraction of pages that should declare a freshness lifetime
min_validator_rationumber0.6Minimum fraction of pages that should expose a validator (ETag or Last-Modified)
min_compression_rationumber0.8Minimum fraction of compressible responses that should be gzip/Brotli compressed

Configuration Example

squirrel.toml
toml
[rules."perf/bad-caching"]
min_freshness_ratio = 0.6
min_validator_ratio = 0.6
min_compression_ratio = 0.8

Enable / Disable

Disable this rule

squirrel.toml
toml
[rules]
disable = ["perf/bad-caching"]

Disable all Performance rules

squirrel.toml
toml
[rules]
disable = ["perf/*"]

Enable only this rule

squirrel.toml
toml
[rules]
enable = ["perf/bad-caching"]
disable = ["*"]

Type to search…

↑↓ navigate ↵ open esc close