Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stale-while-revalidate and stale-if-error cache-control extensions #3421

Closed
akira28 opened this issue Feb 29, 2020 · 0 comments · Fixed by #3439
Closed

Support stale-while-revalidate and stale-if-error cache-control extensions #3421

akira28 opened this issue Feb 29, 2020 · 0 comments · Fixed by #3439

Comments

@akira28
Copy link

akira28 commented Feb 29, 2020

Description
At the moment neither stale-while-revalidate nor stale-if-error are supported natively by Api Platform HTTP cache system. These extensions are described in this RFC and supported in Symfony through SensioFrameworkExtraBundle

Example
Using this configuration:

api_platform:
    http_cache:
        max_age: 0
        shared_max_age: 3600
        stale_while_revalidate: 15
        stale_if_error: 30

or using the cacheHeaders attribute in the entity:

/**
 * @ApiResource(cacheHeaders={"max_age"=0, "shared_max_age"=3600, "stale_while_revalidate"=15, "stale_if_error"=30})
 */

would produce this cache-control:
max-age=0, s-maxage=3600, stale-while-revalidate=15, stale-if-error=30

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

Successfully merging a pull request may close this issue.

3 participants