Documentation · ViewHelper reference

XSD schema file | vhs master

Render / CacheViewHelper

Cache Rendering ViewHelper

Caches the child content (any type supported as long as it can be serialized). Because of the added overhead you should only use this if what you are caching is complex enough that it performs many DB request (for example when displaying an object with many lazy properties which don't load until the template asks for the property value). In short, applies to just about the same use cases as any other cache - but remember that Fluid is already a very efficient rendering engine so don't just assume that using the ViewHelper will increase performance or decrease memory usage.

Works forcibly, i.e. can only re-render its content if the cache is cleared. A CTRL+Refresh in the browser does nothing, even if a BE user is logged in. Only use this ViewHelper around content which you are absolutely sure it makes sense to cache along with an identity - for example, if rendering an uncached plugin which contains a Partial template that is in all aspects just a solid-state HTML representation of something like a list of current news.

The cache behind this ViewHelper is the Extbase object cache, which is cleared when you clear the page content cache.

Do not use on form elements, it will invalidate the checksum.

Do not use around ViewHelpers which add header data or which interact with the PageRenderer or other "live" objects; this includes many of the VHS ViewHelpers! /

  • Tag usage example

    <v:render.cache content="NULL" identity="NULL" onError="NULL" graceful="1">
    	<!-- tag content - may be ignored! -->
    </v:render.cache>
  • Inline usage example

    {v:render.cache(content: 'NULL', identity: 'NULL', onError: 'NULL', graceful: 1)}

Arguments

Argument Description Type
content

Content to be cached

string
graceful

If forced to FALSE, errors are not caught but rather "transmitted" as every other error would be

boolean
identity

Identity for cached entry

string
onError

Optional error message to display if error occur while rendering. If NULL, lets the error Exception pass trough (and break rendering)

string
Required attribute

Revision history

commit a17516f829e0e9933956e2a73fbd088e6d767bd8
Author: Claus Due <*****@wildside.dk>
Date:   Sat Nov 10 21:27:08 2012 +0100

    [FEATURE] Rendering Cache ViewHelper

commit bfc61f2bd71f8d78891217ff0fc498b00c57339f
Author: Claus Due <*****@wildside.dk>
Date:   Sat Jan 26 15:40:39 2013 +0100

    [DOC] Doc comment for Render / Cache ViewHelper

commit c40695b398b27a45a6e1cfddcb726745ad060231
Author: Claus Due <*****@wildside.dk>
Date:   Sat Apr 20 09:24:35 2013 +0200

    [BUGFIX] Reverse order __toString / Domain object id fetch
    
    Fixes: #109

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit d2e531da034976e6db1478eef5a8478595fd16fe
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Jan 5 00:45:10 2014 +0100

    [TASK] Migrate to using namespace core class names

commit e9ce10ca7a05290ad1a4832f3a8f895e0e4257ff
Author: Claus Due <*****@namelesscoder.net>
Date:   Tue Apr 15 01:28:19 2014 +0200

    [FEATURE] Implement a proper caching framework cache

commit 52bd6e41ccfef3d8193b350153912a9716e6a087
Author: Benjamin Rau <*****@codearts.at>
Date:   Tue Apr 1 21:09:00 2014 +0200

    [TASK] CGL compliance

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit d2616b82cef670076d8c0615eeb2637da516b797
Author: Daniel Scho╠łne <*****@schoene.it>
Date:   Fri Nov 28 15:15:02 2014 +0100

    [BUGFIX] Fix cache identifier prefix used by <v:render.cache />
    
    fixes: #732

commit 4981055359c895f3869e5bd878293b3c15ed26e5
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 14:01:04 2015 +0100

    [TASK] CGL - Define classes, params, use imports

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file