Forums / Developer / Caching problems

Caching problems

Author Message

Oliver Frommel

Saturday 06 October 2007 5:09:50 am

Hello,

we have some caching problems on our sites I wanted to solve with
Smart View Caching. Unfortunately this did not work out as expected.
It is a fairly standard situation with news items buried somewhere in the storage hierarchy but supposed to show up on the homepage as well.

I put the following lines in the viewcache.ini.append.php of the admin siteaccess of the site (using the admin siteaccess is the right place, isn't it):

[ViewCacheSettings]
SmartCacheClear=enabled

[lmi_news]
AdditionalObjectIDs[]
AdditionalObjectIDs[]=14877

'lmi_news' is of course the class identifier of the news objects. 14877 is the node id of the homepage. According to the documentation I think this should work. Being unsure i tried the following block as well:

[lmi_news]
DependentClassIdentifier[]
DependentClassIdentifier[]=lmi_startpage
ClearCacheMethod[]
ClearCacheMethod[]=object
ClearCacheMethod[]=parent
AdditionalObjectIDs[]
AdditionalObjectIDs[]=14877

This did not change anything however. The news show up in the corresponding folder but not on the homepage. The pagelayout.tpl has two cache blocks with
keys=$module_result.uri. The template of the actual homepage has no cache blocks at all. However i tried to set the TTL with {set-block scope=root variable=cache_ttl}0{/set-block} as proposed in the thread http://ez.no/developer/forum/developer/view_cache_trouble.

I am unsure about how and when to make use of Smart View Caching in general and how it corresponds with cache blocks and the TTL. For instance the documentation says that cache-blocks are meant to be used in pagelayout.tpl but it might be used in other templates as well. I don't understand how cache-blocks relate to view caching, smart view cache cleaning and vice versa.

I think I read most of the documentation but I still can't get it to work.

Thanks for your help
Oliver

 

Petr Mifek

Saturday 06 October 2007 9:32:24 am

At first sight, I think the ini should be either in the siteaccess, where the news doesn't showed up, or in the override. The admin siteaccess is problably not the right place for this. There may be additional problems in the config, but this one is obvious after brief reading your message.

Good luck!

Damien Pobel

Saturday 06 October 2007 3:41:19 pm

Hi,

I think Petr is right, you should put your viewcache.ini.append.php in settings/override instead.
But if your lmi_news on the homepage are shown using the pagelayout templates (or an include in it) the Smart Cache Clear will not solve your problem as it only concerns the cache of $module_result.content [1].
If you have a cache-block around the template code that fetch your lastest lmi_news you should check the subtree_expiry parameters of cache-block [2].
You can find a good example in "eZ Publish Performance Optimization Part 3 of 3: Practical Cache and Template Solutions" [3]

[1] http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching
[2] http://ez.no/doc/ez_publish/technical_manual/3_9/reference/template_functions/miscellaneous/cache_block
[3] http://ez.no/developer/articles/ez_publish_performance_optimization_part_3_of_3_practical_cache_and_template_solutions

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Oliver Frommel

Sunday 07 October 2007 1:23:56 am

hmm, I had the same settings in the regular siteaccess before and it didn't work. So i tried to put it in the admin access as described here:

"make sure the "viewcache.ini.append.php" file located in the "settings/siteaccess/example_admin" directory (replace "example_admin" by the name of the siteaccess that is used for adding and editing content) contains the following lines:
[ViewCacheSettings]SmartCacheClear=enabled"
http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching/smart_view_cache_cleaning

This also seems to make sense, so i tried it. However I had no success with both approaches.

Thanks for your hints
Oliver

Xavier Serna

Monday 08 October 2007 12:34:53 am

Hi all,

the viewcache settings must be set in the siteaccess used to publish content (usually admin siteaccess). And in the AdditionalObjectIDs array I believe that must be specified the ObjectID of the home, not the NodeID.

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Petr Mifek

Monday 08 October 2007 12:57:01 am

Xavier is right. Today I've checked some our configs and it the problem seems to be in the >Object<ID. I've been thinking in multisite-ezwebin's context... Sorry for misguiding you.

Good luck!

Oliver Frommel

Tuesday 09 October 2007 4:50:29 am

Ok, I guess using the admin site access and object ID will be ok. Thanks for your help.

However it still doesn't work although I tried virtually every combination of settings in the viewcache.ini and different cache-blocks in the template. For instance using a {cache-block expiry=120} around the template fetch and display code for the news items as a brute force approach didn't work either.

Could it be a problem with our setup? With this site we have two different site accesses 'sa1' and 'sa2' sharing the content and most of the templates, too. The templates for the homepage differ though. That means we have two templates 'startpage1.tpl' (for sa1) and 'startpage2.tpl' (for sa2). We have only one admin site access for both sites - and thus only one viewcache setting as well. Is it possible that the caching of one site access intereferes with the other?

I tried both, using the same cache directory for both sites (say var/cache_sa1), and using a separate cache directory each site (say var/cache_sa1 and var/cache_sa2). What is the right approach?

Thanks
Oliver

Xavier Serna

Tuesday 09 October 2007 7:21:01 am

What eZ version are you trying with? Forgot to mention that AdditionalObjectIDs settings is available only in >3.9.0.

Also, along with the AdditionalObjectIDs setting you must specify the clearcachemethod, in your case 'object' would be ok.

And, for the var/cache issue, if both siteaccess are sharing the same db, it's ok to use the same var dir, not sure but perhaps for all this to work, this is a must.

More info can be found here:
http://ez.no/doc/ez_publish/technical_manual/3_9/features/view_caching/smart_view_cache_cleaning

hth!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Oliver Frommel

Tuesday 09 October 2007 9:30:26 am

This is all fine and dandy: We are using eZ Publish 3.9.2.

I also read the documentation you pointed me too but still don't get it :) In my opinion the docs should be a bit more clear, maybe even more formal to point out what directives are required and which are optional and which combinations are, too.

For instance if you take a look at Example 5 you will see that they are using the AdditionalObjectIDs without a clearcachemethod. It might be somewhere else in the imaginary ini file buw how knows. Or am I missing something?

Anyway thanks a lot for your help.
Oliver