Skip to content

@cache: send an Age header on hits so downstream freshness does not reach 2×ttl #254

Description

@allen0099

A hit sends the full max-age=ttl and no Age. An entry stored at t=0 with ttl=60 and served at t=59 is fresh downstream until t=119, so after invalidate() a browser or CDN can keep serving the old response for almost twice the ttl (RFC 9111 §4.2.3, §5.1).

Proposal

Store stored_at in CacheEntry (optional, like status_code) and emit Age on hits and cached-ETag 304s, or lower max-age to the remaining ttl.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthttp-cacheThe @cache decorator, cache keys and Cache-Control handling

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions