Skip to content

FR: stale-while-revalidate and stale-if-error cache semantics (RFC 5861) #50

Description

@passcod

🤖 Browsers and CDNs both lean on RFC 5861; a server-side client benefits even more, since a warm cache that never blocks on revalidation is pure tail-latency win.

  • stale-while-revalidate: serve the stale entry immediately, revalidate in the background.
  • stale-if-error: a revalidation that fails with a network/5xx error falls back to the stale entry. (Chrome effectively does this even when the directive is absent.)

First step is discovery: check what http-cache / http-cache-semantics already support — this may be an options flip, an upstream contribution, or a middleware-layer behaviour, in that order of preference. The background-revalidation half needs a task handle and single-flight per cache key, similar in shape to the probe machinery in #45.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions