Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hello! Could I please clarify what amounts to a "change" in the Admin Panel i.e. something that will trigger Couch to serve a fresh version of a page rather than the cached version. In particular with reference to using an editable region as part of the cms:pages selection criteria.

Say, for a news page I want to split the news items in 2 lists - by a cutoff date - so recent and old news.

I could create a cloned template news-items.php and have news_cutoff in globals.php and have the following code inside news-items.php:

<cms:pages masterpage='news-items.php' order='desc' start_on=news_cutoff >

<cms:pages masterpage='news-items.php' order='desc' stop_before=news_cutoff >

If the client changes news_cutoff I am assuming that this will not amount to a "change" and the cached page will be served.

If I create another template - news.php - non-cloneable - with news_cutoff inside this template and insert the cms:pages tags inside this template - I am guessing that an alteration to news_cutoff will amount to a "change" and Couch will serve a fresh version of the page.

I'm thinking therefore that although it is neat to have site-wide bits & pieces in globals.php it is best not to use globals.php for setting up selection criteria for cloned pages - because the listing won't reflect a change in the criteria. That is if we want to use cache wherever possible.

p.s. Apologies because I realise I could test this all out for myself but I don't currently have a suitable setup available. Sorry! Hopefully someone else will find it useful.
Hi,

It is basically very simple - anytime you hit 'save' while editing *any* page of *any* template, the cache gets invalidated for *all* templates.

So, in your example, since global.php is a Couch managed template and 'news_cutoff' is an editable region defined within it, anytime your client changes the date and saves, the cache goes bust and the new value will be used whichever template the region might be used in.

Hope this helps.
thanks KK ... I get what you are saying - but this makes me think that in the scenario I describe - where news_cutoff is in globals.php - the cache won't be busted - because nothing has actually changed for news-items.php - only the input date (from globals.php) to the cms:pages tag. So despite having a new value for news_cutoff the stored version of news-items.php will be served because nobody has hit 'SAVE' for any page associated with the template.
because nobody has hit 'SAVE' for any page associated with the template.
That is exactly the point I was trying to emphasize in my post - a save made on *any* template (globals.php in your case) will invalidate the *full* cache and force Couch to serve fresh pages for *all* templates (including news-items.php in your case).

Hope I was able to explain myself more clearly this time :)
ah a bit slow on the uptake there ... got it! I had no notion that this would be the case, I had assumed it was on a template basis.

Many thanks for clarifying!
Well, Couch allows using any template's data on any other template. Selectively caching pages based on their templates wouldn't have worked. This is precisely why we have this kind of 'all or nothing' cache.
6 posts Page 1 of 1
cron