How to disable caching for renderDynamic

Hi,

how do I disable caching for method CController->renderDynamic(‘myMethod’)?

I have a page which is cached except for 2 the dynamic fragments (benchInfo and processComments).

view column2.php:




...

$this->renderDynamic('benchInfo');

...

$this->renderDynamic('processComments');

...



The problem is, that comments are showing twice - first time displayed by calling $model->listComments() and right after that loaded from cache (if previously cached, e.g. on F5 refresh page).

I need to disable caching for ‘processComments’ in COutputCache.

I tried:

  • varyByParams - not helping since URL parameter won’t change on refresh,

There is no setting for excluding caching of dynamic contents in COutputCache.

I would welcome extra parameter in method signature like:


$this->renderDynamic('processComments', false);

where ‘false’ may explicitly forbid or allow caching.

Is there any other way…?

Thanks for any advice.

Lubos

I solved the issue - the problem was, that methods called by renderDynamic must always RETURN output instead ECHOing it to output buffer. This way dynamic content will be always cached into CController->_dynamicOutput[] stack.

Gosh, I like replying myself:-)

Cheers

Lubos