psf / psf/cachecontrol

Support for stale-while-invalidate

Open
#204 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
505
Forks
149
Avg merge
2d 13h
Merged PRs (30d)
7

Description

RFC-5861 introduces a cache-control extension "stale-while-invalidate":

When present in an HTTP response, the stale-while-revalidate Cache-
Control extension indicates that caches MAY serve the response in
which it appears after it becomes stale, up to the indicated number
of seconds.

If a cached response is served stale due to the presence of this
extension, the cache SHOULD attempt to revalidate it while still
serving stale responses (i.e., without blocking).

We're talking to a service that uses this directive, which is causing our client to log an error:

cachecontrol.controller | Ignoring unknown cache-control directive: stale-while-revalidate

AFAICT stale-while-invalidate is not an official directive and is not part of RFC-7234 (caching), but there might be value in supporting it in cachecontrol nonetheless.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cachecontrol.controller handling mentioned in the error and compare the RFC-5861 and RFC-7234 references, noting the issue's inconsistent use of “invalidate” and “revalidate.” Done should define and test the intended handling of this directive so valid input is no longer incorrectly reported as unknown.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.