This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Template cache created but not used
expandshrink

Template cache created but not used

Template cache created but not used

Thursday 23 August 2012 7:07:51 pm - 8 replies

Hey,
I'm having an issue where my template cache seems to getting created but not used.

I'm seeing updated files in /var/my_folder/cache/template/compiled but when my site load I'm seeing no drop in queries after the first load.

I have the following set in my siteaccess' site.ini.append.php:

[FileSettings]
VarDir=var/my_folder

and 

[TemplateSettings]
TemplateCache=enabled

 

Any thoughts?

Thcanks!

Thursday 23 August 2012 10:25:43 pm

Dunno, but ViewCaching is the one that make the big difference for me.

Friday 24 August 2012 3:54:41 am

Yeah, I'm hoping ViewCaching will work once I get template caching working. Caching is working on my Dev server but not on my production server. I can't find what's different between them.

Friday 24 August 2012 4:27:20 am

Hey Steven,

Are you able to outline your key configuration settings to get ViewCaching working?

Cheers,

Josh

Friday 24 August 2012 7:35:04 am

Hi Josh, 

Indeed, ViewCaching is the way to go. Having the following settings in settings/override/site.ini.append.php will enforce that your website is cache-enabled:

[ContentSettings]
ViewCaching=enabled
 
[TemplateSettings]
Debug=disabled
TemplateCache=enabled
TemplateCompile=enabled
DevelopmentMode=disabled

Side-question: how did you identify that template cache was not working on your prod server while working on the dev server ?

Cheers,

Modified on Friday 24 August 2012 7:35:40 am by Nicolas Pastorino

Friday 24 August 2012 8:12:24 am

Hey Nicolas,

I have these settings set for my front-end site access but I'll chuck them in the override site.ini and see if that makes a difference.

On my dev server I could identify caching was working because the number of queries processes dropped after the first load of the site. But on my prod server this wasn't happening, so I went hunting on the prod server in the /var/ directory to see if I could find some cache files that were being generated.

So as I had "VarDir=var/my_folder" set in my site.ini, I went looking on my prod server in /var/my_folder/cache/<siteaccess> and I could find files that were being generated in the "/templates/compiled" directory each time I cleared the cache, the hit the site again. This lead me to believe the cache was being generated but not being used by the site because my query count wasn't dropping.

Thanks for your help!

Cheers,
Josh 

Friday 24 August 2012 8:43:53 am

Hi Josh, 

The sequence is as follows concerning templates: 

  1. parsing,
  2. compiling ( if TemplateCompile is enabled )
  3. caching ( ie: storage of the compiled template, stored under templates/compiled, if TemplateCache is enabled )

When both TemplateCompile and TemplateCache are enabled, and DevelopmentMode disabled, the first time a template is requested, it follows the sequence described above. If it is a "node template", ViewCaching kicks-in (if enabled happy.gif Emoticon ) and stores the HTML output of the module request, for re-use in the next request to the same URL. If the template is a "system template", the compiled version ( a PHP file, actually ) will be executed upon every new incoming request, with no layer of additional caching. Generally, when all of eZ Publish's cache is cleared, the template need a re-compile. This explains the behaviour you could observe on your production server, which is normal. 

In case of a node template above, ViewCaching is the very tool to reduce the amount of DB round-trips. It is strongly recommended to have it enabled on any production website. This system is decoupled from the template system, and is enabled by default. I tend to think that it might be disabled in your case if the amount of DB requests if important on your production server. 

Let us know how things go Josh, 
Cheers, 

Friday 24 August 2012 12:14:27 pm

Hey guys,

It's working now! I think I still need to tweak some of my cache blocks but I can see that caching is working now. I looks like adding the setting to the override/site.ini did the trick, not just having the setting in the siteaccess/site.ini

Thanks all for your help!

Cheers,
Josh 

Friday 24 August 2012 12:21:20 pm

Quote from Josh Millard :

It's working now! I think I still need to tweak some of my cache blocks but I can see that caching is working now. I looks like adding the setting to the override/site.ini did the trick, not just having the setting in the siteaccess/site.ini

Great !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from