Feature #60181

Caching mechanism for Fluid Views/Templates

Added by Kevin Fischer about 1 year ago. Updated about 1 year ago.

Status:New Start date:2014-07-08
Priority:Could have Due date:
Assigned To:- % Done:

0%

Category:View
Target version:-
Has patch:No

Description

It would be nice to have have a way to tell Fluid to cache the result of a getter or ViewHelper. This could be done e.g. by prefixing the expression with a $, a similiar special character or otherwise indicating that Fluid should cache this expression:

Won't cache: {object.myComplexGetter}
Will cache: {$ object.myComplexGetter}
Uncached: {object.myComplexGetter}
Cached: {$ object.myComplexGetter}
Won't cache: {acme:time.consuming()}
Will cache: {$ acme:time.consuming()}
Uncached: {acme:time.consuming()}
Cached: {$ acme:time.consuming()}

The cache would operate on a per-file basis, as caching across multiple (independent) template and partial files could raise unforeseen issues and hard-to-debug errors.

The cache would only care about the first part of an expression chain. All subsquent parts of a chain would be executed normally. To avoid running a long or time consuming expression more than once, you could still use the <f:alias> ViewHelper.

Will cache: {$ object.myComplexGetter}
Uses cached result: {$ object.myComplexGetter -> f:count()}

Uses cached result, with the time consuming VH being executed every time:
{$ object.myComplexGetter -> acme:time.consuming()}

I'd love to hear ideas and comments about this. Currently I'm using lots <f:alias> in my code to accomplish this and I'd love to avoid it where possible.

A related feature request for ViewHelpers from someone else: http://forge.typo3.org/issues/3291


Related issues

related to TYPO3.Fluid - Feature #3291: Cacheable viewhelpers Needs Feedback 2009-05-14

Also available in: Atom PDF