How to cache layout

If it is possible how to cache layout?

Sure. Here is a down and dirty way.

I just typed this into the box directly… Please forgive typos.

function myEvent(Event,RC,PRC) cache = false {

var cachekey = ‘abc123’;
var cachedResult = variables.CacheBoxNamespace.get(cachekey);
if (!isNull(cachedResult)) {
Event.renderData(data=cachedResult,type=‘html’);
return;
}

… do your stuff

Event.setView(…);

var result = getPlugin(‘Renderer’).renderLayout();
variables.CacheBoxNamespace.set(cachekey,result);

… cache the view using CacheBox
Event.renderData(data=result,type=‘html’);

return;
}

can i simply say somwthing like this
event.setlayout(name="layoutName",cache=true)

No but that’s a great idea. Can you submit this as a enhancement request

can I put this into interceptor .SO it can be used anywhere

Yes

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano