Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML Wrap
alignright
classmenu
Page properties
Download

Artifact resource link
rangeHigherVersion1.9
groupIdinfo.magnolia.advancedcache
artifactIdmagnolia-advanced-cache-dpc
label$artifactId.jar
renderTypedownload_link
resourceTypeJAR

EditionEE Pro, Cloud
License
Include Page
_MLA
_MLA
IssuesMGNLADVCACHE
Maven siteAdvanced Cache
Latest version

Artifact resource link
rangeHigherVersion1.9
groupIdinfo.magnolia.advancedcache
artifactIdmagnolia-advanced-cache-dpc
label$version
renderTypedisplay_only
resourceTypeJAR

Dynamic Page Caching allows you to 

Excerpt

cache static content on an otherwise dynamic page

. You can mark which areas and components are dynamic. Magnolia will cache all static content and only renders the dynamic components per request. You can also set a different time-to-live on the dynamic components.

Table of Contents

Prerequisites

Dynamic page caching requires modules:

Read more about configuring Dynamic page caching.

Installing

Include Page
_Maven is the easiest way to install
_Maven is the easiest way to install

Artifact maven dependencies snippet
rangeHigherVersion1.9
groupIdinfo.magnolia.advancedcache
artifactIdmagnolia-advanced-cache-dpc

Include Page
_Pre-built jars are also available
_Pre-built jars are also available

  • Artifact resource link
    rangeHigherVersion1.9
    groupIdinfo.magnolia.advancedcache
    artifactIdmagnolia-advanced-cache-dpc
    label$artifactId.jar
    renderTypedownload_link
    resourceTypeJAR

Uninstalling

Shut down Magnolia, remove magnolia-advanced-cache-dpc.jar from WEB-INF/lib and start up Magnolia again.

Dynamic page caching

The module brings info.magnolia.module.advancedcache.rendering.DynamicFragmentDefinition. If you want to mark an area/component as a dynamic one, just add it to its template definition:

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl f
commenting


    

Mgnl f
templates


        

Mgnl f
components


            

Mgnl n
comments


                

Mgnl n
fragmentDefinition


                    

Mgnl p
class

info.magnolia.module.advancedcache.rendering.DynamicFragmentDefinition

                    

Mgnl p
ttl

0

                    

Mgnl p
mechanism

sitemesh

                    

Mgnl p
dynamic

true


Apart from the dynamic property you can set also time to live (ttl) in seconds. The zero means that this component can't be cached. Mechanism is a tool such as SiteMesh which inserts dynamic content into a dynamic page. This mechanism will replace injection tags created by Fragment Injection Listener with fresh content of dynamic components.  

Anchor
FragmentInjectionListener
FragmentInjectionListener

Fragment injection listener

info.magnolia.module.advancedcache.rendering.FragmentInjectionListener is a rendering listener which surrounds all dynamic areas/components with injection tags. Rendering listeners are configured under config:/server/rendering/engine/listeners.

Configurable fields in FragmentInjectionListener:

FieldDescriptionAvailable valuesDefault value
beforeA text to be injected before dynamic components. Occurrences of ${targetPath} will be replaced with the JCR path to this component. Occurrences of ${TTL} will be replaced with DynamicFragmentDefinition#getTtl.any string-
afterA text to be injected after dynamic components. Occurrences of ${targetPath} will be replaced with the JCR path to this component. Occurrences of ${TTL} will be replaced with DynamicFragmentDefinition#getTtl.any string-
targetPathThe URI format of dynamic components.

RELATIVE_TO_SERVER_ROOT RELATIVE_TO_CONTEXT_ROOT
RELATIVE_TO_CURRENT_PAGE

RELATIVE_TO_CONTEXT_ROOT
skipRenderingSkip rendering of dynamic components if true, otherwise renders current content of the component. Rendering of current content of dynamic components (which will be stored in cache and can be obsolete later) could be useful as fallback if fresh content of this component can't be retrieved because of an error.true, falsefalse

Performance

The main goal of dynamic page caching is improving of performance thanks to the ability of caching pages with a dynamic content. Here are few points to remember:

  • Every dynamic component needs to be requested separately. That means: more dynamic component = more time to render.
  • Keep in mind that rendering of a cached page with huge amount of dynamic components could be slower than excluding that page from cache!
  • Although recursive dynamic fragments (a dynamic component inside of other dynamic component) are supported, it doesn't make sense to use this feature unless you need to cache them with different TTL.
  • Try to group dynamic components which are located next to each other into one dynamic component/area.