Forums / Developer / Delete cache of a node that shows some objects

Delete cache of a node that shows some objects

Author Message

Jerome Despatis

Wednesday 24 August 2011 3:55:50 am

Hello,

I have a page that performs a fetch of some objects

Of course, due to the view cache, whenever I manage those object, the page cache is not cleaned, and therefore is obsolete

=> How can I tell eZ to delete the cache of this node, whenever some objects of a specific class are modified ?

(This page/node has no relation with those objects, I use in the page the fetch('tree') template operator)

Hamdi Laadhari

Wednesday 24 August 2011 4:16:00 am

Have a look at the smartCacheClear feature of ezpublish

Certified eZ Publish Entreprise 4.5
http://www.laadhari.fr

Jerome Despatis

Wednesday 24 August 2011 4:46:49 am

Yes but what rule would you put ?

I have no relation between my page and the objects shown on it

Would be nice for me to tell eZ to expire all cache of a specific node whenever a new version of an object of a specific class is created

Daniel A. Øien

Wednesday 24 August 2011 5:54:19 am

You need to put the object ID of the node in the appropriate class section in settings/override/viewcache.ini.append.php. For example, if your node is an object of the article class:

[article]
DependentClassIdentifier[]=folder
DependentClassIdentifier[]=frontpage
ClearCacheMethod[]=object
ClearCacheMethod[]=parent
ClearCacheMethod[]=siblings
ClearCacheMethod[]=relating
AdditionalObjectIDs[]
AdditionalObjectIDs[]=xxxx

Also, you need to have smart Cache clearing enabled in settings/siteaccess/<your_admin_siteaccess>/viewcache.ini.append.php:

[ViewCacheSettings]
SmartCacheClear=enabled

Daniel A. Øien
Open Concept SA, Norway
Web: http://openconcept.no/
In English: http://openconcept.no/eng

Jerome Despatis

Wednesday 24 August 2011 9:55:26 am

Thanks Daniel,

I have a last problem: the page that performs some objects, shows objects AND also drafts

And as I can see on viewcache, the rules from viewcache.ini are followed for newly published object right ?

So I guess that even if I find the good setting for viewcache, whenever I create a draft, my page won't show those ones right ?

For now, I've disabled the cache for this page, as I haven't found a better option... tell me if I'm wrong!

with ViewCacheTweaks[236]=disabled