-
Notifications
You must be signed in to change notification settings - Fork 337
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
cacheLifetime in template.xml is ignored #6301
Comments
This is the correct behaviour the This is common practice in server side caching, to control how long the cache for your own cache server is and set s-maxage for third party proxy caches. So for completeness: x-reverse-proxy-ttl: Cachelifteime for your own cache server (symfony, varnish, ..) If your cache server does not support |
The easist way would be I think add your own listener: https://github.com/sulu/skeleton/blob/dcc0a19dbb978d82729411546d9f7d4db50d5b47/src/Kernel.php#L38 here instead of overwrite the SuluHttpCache class. |
Thanks for the detailed explanation. In my opinion it is not clear (as there is no documentation) that cacheLifetime is for server side caching only. So Sulu does not have any built in way to set the cache-control header on a template per template basis? |
No sulu supports out of the box |
Want to also mention currently only varnish and symfony http cache (with our the psr6store) supports tag based caching. Things like nginx or third party services cloudfront as I remember does not support tag based caching / cache invalidation. |
Server side caching is not at the core of this issue, I just want to say to the browser you can cache pages of this template for x amount of time. So server side caching (symfony, varnish or something else) is another topic. The only way to set a max-age header seems to be with
|
Thanks, yes I know, tag cache invalidation is not that important at the moment. |
@ampaze The cache config is all part of the SuluHttpCache Bundle and if no adapter is configured nothing will be cache or configured as it is then like you are in |
Using my own CacheLifetimeEnhancer is a good idea! I had to extend CacheLifetimeEnhancer instead of just implementing the interface, because of protected function getCacheTimeLifeEnhancer(): ?CacheLifetimeEnhancer But it works now. |
This should definitly be the |
I take that back, I now also need a way to have the CacheLifetimeEnhancer be used even if no proxy_client is configured ... |
Actual Behavior
<cacheLifetime>xx</cacheLifetime>
is ignoredExpected Behavior
<cacheLifetime>xx</cacheLifetime>
should be usedSteps to Reproduce
In your template.xml set
<cacheLifetime>20</cacheLifetime>
in sulu_http_cache.yaml set
The resulting response header is
Cache-Control: max-age=10, public, s-maxage=10
The text was updated successfully, but these errors were encountered: