Your Rating: |
![]() ![]() ![]() ![]() ![]() |
Results: |
![]() ![]() ![]() ![]() ![]() |
94 | rates |
Implemented in 4.4.6 4.5
Introduction
Templates and paragraphs should be able to influence caching.
Caching can be controlled by response headers.
Use case 1 - Exclude from cache on error
- Cache filter decides that the request can be cached
- Template is rendered, in its definition nothing is specified
- A paragraph in the page encounters a problem getting things from a RDBMS to render and renders an error, it doesn't want this to be cached so sets no-cache
Use case 2 - Paragraph model overrides Template model
- Cache filter decides that the request can be cached
- Template is rendered, in its model i max 5 minutes
- A paragraph in the page is rendered and is configured to be cacheable for 1 day
The page is not cached at all
Use case 3 - Caching configured on renderables
- Cache filter decides that the request can be cached
- Template is rendered, in its definition its specified that is must be cached for max 5 minutes
- A paragraph in the page is rendered and is configured to be cacheable for 1 day
The page will be cached for 5 minutes since its the most restrictive advice seen during rendering
Requirements
- Caching should be changable in RenderingModel and in template script
- Controlling caching should be done with cache headers
Implementation
- CacheFilter will use a CacheResponseWrapper that looks at cache headers being set and changes its behavior to reflect the most restrictive header
- headers set by templates/components are not outputted on the actual response, EXCEPT when caching is turned off / bypassed in which case the last header set before the response is committed is what gets sent
- HttpServletResponse.containsHeader() will always return false for cache headers
- using info.magnolia.cms.util.RequestHeaderUtil#addAndVerifyHeader for those will always fail, not done anywhere now what it seems
To be decided
- caching do-not-cache decisions or not, caching it means a paragraph cant change its mind, like if it don't want to be cached due to an error, but the next request is ok to cache
Overview
Content Tools
Apps
Activity