cache page layout

Page layout cache is great for static pages, but is there a way to make it working with dynamic sites?

We have a website where a page has a lot of shared content which could be cached, but there are small areas which are customized for each user, e.g. Login/Logout in navigation

So is there a way to have conditional caching ,e.g. layout cache for guest users and cache page content for logged in users?

Or maybe have some placeholders in Page Layout Cache which can be replaced afterwards?

Hi Gunnar, this is a very typical problem.

The best approach we have found is to bring everything via Ajax that is personalized. This way, our layout and pages just have placeholder divs and at runtime, those personalized areas are brought in via angularJS or any ajax call.

This is the best approach we have used so far.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Hi Luis,

most requests come from users which are not logged in (they could use page layout cache) so I would prefer to control the cache behaviour somehow programmtically.
For guest users and bots it doesn’t make much sense to have additional requests.

Any idea how this could be achieved?

Best regards,

Gunnar

I am not sure I follow, can you expand.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

I’m not sure if Ajax is the right thing to do, because it would add another request for each page view. I would prefer to avoid it.

I was wondering if there is an easy way to control the cache behaviour in the handler.

So handler checks if the user is logged in or not. If not logged in, deliver cached layout. If logged in the use “Cache Page Content”.

Does it make sense?

Well, the content object has the caching properties that you can turn on/off programmatically for that specific content object:

property name=“cache” notnull=“true” ormtype=“boolean” default=“true” index=“idx_cache”;
property name=“cacheLayout” notnull=“true” ormtype=“boolean” default=“true” index=“idx_cachelayout”;
property name=“cacheTimeout” notnull=“false” ormtype=“integer” default=“0” index=“idx_cachetimeout”;
property name=“cacheLastAccessTimeout” notnull=“false” ormtype=“integer” default=“0” index=“idx_cachelastaccesstimeout”;