-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add fallbackToSmaxage flag to CustomTtlListener and check for isCacheable before calling store #575
Add fallbackToSmaxage flag to CustomTtlListener and check for isCacheable before calling store #575
Conversation
389d421
to
1aa6b86
Compare
cfe0a4a
to
bc3874c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. we can do the extra flag - though setting custom ttl to 0 should have the same effect.
can you explain the flag in the documentation as well, please?
https://github.com/FriendsOfSymfony/FOSHttpCache/blob/3.x/doc/symfony-cache-configuration.rst#custom-ttl
Co-authored-by: David Buchmann <[email protected]>
Co-authored-by: David Buchmann <[email protected]>
Co-authored-by: David Buchmann <[email protected]>
Co-authored-by: David Buchmann <[email protected]>
Co-authored-by: David Buchmann <[email protected]>
* Only call store when response still is cacheable * Add flag to disable fallback to s-maxage to changelog
squashed and merged as 6957dee |
We have the
CustomTtlListener
enabled but we have controllers which set only as-maxage
thes-maxage
is in our case always only for browsers and should never used by Symfony or Varnished HttpCache / reverse proxy.The current
CustomTtlListener
still fallbacks always back to s-maxage / maxage this should in my opinion not the case ifCustomTtlListener
the HttpCache should only listen on the configured header and ignore the max age headers./cc @Toflar @dbu Alternativily we should also add a option to the
CustomTtlListener
disableFallback
/enableFallback
.Update
As discussed below we will add additional
fallbackToSmaxage = true
parameter to make it possible to disable that fallback mechanism.Additional this pull request adds a recheck for
$response->isCachable
after the listeners were run. That not only improve performance for response setting a ttl to 0 but its now possible to set a response to private in a preHandle listener event to also disable the caching.