Forums / Developer / Preventing cache on a piece of code (on a site that needs cache on other pages)

Preventing cache on a piece of code (on a site that needs cache on other pages)

Author Message

Tony Wood

Monday 23 June 2003 1:59:30 am

eZ ver: 3.0-2 (latest svn for 3.0)
Is there a way of preventing a piece of tpl code being cached? This is on a site the requires cache to be on for speed but a particular page needs to be excluded from the cache.

The main problem is that we are passing a variable via GET to the page and using that to fill a form. The probme is that the cache uses the page id and creates a cache from that. This means that the page always looks the same after the cache is built.

Any ideas on how to prevent a page from being cached?

tia

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Tony Wood

Monday 23 June 2003 2:33:40 am

I have tried expiry but this doesn't work...
i.e. {cache-block keys=$node_id expiry=0}

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Alexei Pechekhonov

Tuesday 24 June 2003 12:30:40 am

It will be cached everything between {cache-block ...} {/cache-block}
Just exclude the {$module_result.content} from cache area.
Then make another cached piece of code, i think. WE have working site by this way and have no one question.

{cache-block keys=array('firstBlock', $var.... }
........ funny code ........
{/cache-block}
{$module_result.content}
{cache-block keys=array('secondBlock', $var.... }
........ funny code ........
{/cache-block}
Hope it'll help.

Paul Forsyth

Tuesday 24 June 2003 12:47:42 am

Unfortunately our setup is as you describe already. We don't use cache-block around our module_result since *_class_*.tpl files are cached anyway (with cache on...).

Inside the full_class we execute our function call {$my_func} to retreive the GET variables. But this whole page gets cached include our function results. Trying an include for our function call doesn't seem to work either as we hoped the include wouldn't be cached. Even trying unique keys for the function call didn't work...

Paul

Brendan Pike

Sunday 06 March 2005 9:03:09 pm

Hi Paul, did you ever find the solution to this problem? I find myself in the same situation with an override template which I use to control enum values in edit mode.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.