Static cache - publishing doesn't update static cache

Author Message

David Goddard

Friday 13 May 2005 4:08:25 am

Hi

Running makestaticcache.php creates the cache files, but publishing an object doesn't create a new static cache html file. Am I missing a step?

I've cleared all caches
I've made sure that the webserver has write permissions to the static cache directory

settings/siteaccess/plain_user/staticcache.ini.append.php
[CacheSettings]
HostName=ez3-6.djg-1.css.qmul.ac.uk
StaticStorageDir=var/plain_user/static
MaxCacheDepth=3

CachedURLArray[]
CachedURLArray[]=/*

AlwaysUpdateArray[]
AlwaysUpdateArray[]=/
AlwaysUpdateArray[]=/events

I check that these are being picked up correctly in Setup > ini settings

Here are the rewrites in my Apache conf (although I don't this this would interfer with the generation of static pages, as it just handles the requests)

 RewriteEngine On
  RewriteLog    /tmp/rewrite
  RewriteLogLevel 4
  RewriteCond   /usr/local/ezpublish-3.6.0rc1/var/plain_user/static/index.html -f
  RewriteRule  ^/$              /usr/local/ezpublish-3.6.0rc1/var/plain_user/static/index.html [L]
  RewriteCond   /usr/local/ezpublish-3.6.0rc1/static/index.html -f
  RewriteRule  ^$               /usr/local/ezpublish-3.6.0rc1/var/plain_user/static/index.html [L]

  RewriteCond   %{REQUEST_METHOD}       !^POST$
  RewriteCond   /usr/local/ezpublish-3.6.0rc1/var/plain_user/static$1/index.html -f
  RewriteRule   ^(.*)$  /usr/local/ezpublish-3.6.0rc1/var/plain_user/static$1/index.html [L]

  RewriteRule !\.(gif|css|jpg|png|jar|ico|js)$ /usr/local/ezpublish-3.6.0rc1/index.php

And of course in settings/siteaccess/plain_user/site.ini.append.php

[ContentSettings]
StaticCache=enabled

Any ideas? I'm stumped.

Thanks

David

Hans Melis

Friday 13 May 2005 5:17:49 am

Hi David

Which siteaccess do you use to publish the objects?

I suspect you're creating them in the admin interface. In the admin interface, static caching is disabled by default so any objects published in that siteacces listen to the siteaccess' settings.

I encountered the same thing, but I haven't tested a solution yet. I think just enabling static caching in the admin interface solves it, because the staticcache.ini contains a list of siteaccesses for which to generate the content.

Hans
http://blog.hansmelis.be

David Goddard

Friday 13 May 2005 9:29:35 am

Hi Hans

Going point! Yes, I am publishing the objects using the admin siteaccess but updating the user siteaccess settings. Doh!

I tried updating the admin siteaccess static caching settings, but it seems that you <b>must</b> also enable static caching at the override level too.

So these are the files and the changes (In this case it's just a test site which caches: / /news* and /events* always updating /news and /events)

settings/override/site.ini.append.php
[ContentSettings]
StaticCache=enabled

settings/siteaccess/plain_user/staticcache.ini.append.php
[CacheSettings]
HostName=ez3-6.djg-1.css.qmul.ac.uk
StaticStorageDir=var/static/plain_user
MaxCacheDepth=4

CachedURLArray[]
CachedURLArray[]=/
CachedURLArray[]=/news*
CachedURLArray[]=/events*

AlwaysUpdateArray[]
AlwaysUpdateArray[]=/
AlwaysUpdateArray[]=/events
AlwaysUpdateArray[]=/news

settings/siteaccess/plain_admin/staticcache.ini.append.php
[CacheSettings]
HostName=ez3-6.djg-1.css.qmul.ac.uk
StaticStorageDir=var/static/plain_user
MaxCacheDepth=4

CachedURLArray[]
CachedURLArray[]=/
CachedURLArray[]=/news*
CachedURLArray[]=/events*

AlwaysUpdateArray[]
AlwaysUpdateArray[]=/
AlwaysUpdateArray[]=/events
AlwaysUpdateArray[]=/news

I guess you could get rid of the settings/siteaccess/plain_user/staticcache.ini.append.php providing you were happy issuing the slightly counter-intuative

php bin/php/makestaticcache.php -s plain_admin -f

which actual updates the user siteaccess using the static caching settings from the admin siteaccess.

Oddly, when I publish an object is updates all the correct static files (by looking at time stamps), but doesn't use the updated data for the object in question. i.e. the unedited verion of the object is published. Only by re-editing (not making any changes) and re-publishing is the object correctly cached. It is almost as if the static caching is being executed <b>before</b> the database has been updated! A bug? Has anyone else got it to work?

I think perhaps I've got the wrong end of the stick with all this and that that this odd side effect is as a result of my misconfiguration.

Anyone elses advice on setting up static caching correctly when updating via the admin siteaccess greatly appreciated.

Cheers

David

Derick Rethans

Monday 23 May 2005 5:41:48 am

There was a bug with generating an cache file with outdated data when transactions where introduced some time ago. I just committed a fix to SVN for this.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 00:20:44
Script start
Timing: Jan 31 2025 00:20:45
Module start 'layout'
Timing: Jan 31 2025 00:20:45
Module start 'content'
Timing: Jan 31 2025 00:20:45
Module end 'content'
Timing: Jan 31 2025 00:20:45
Script end

Main resources:

Total runtime0.0249 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.3828151.2422
Module start 'layout' 0.00510.0047 739.6250220.7500
Module start 'content' 0.00970.0136 960.37501,001.9922
Module end 'content' 0.02340.0015 1,962.367237.9922
Script end 0.0248  2,000.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002510.2057140.0002
Check MTime0.00104.0330140.0001
Mysql Total
Database connection0.00072.789310.0007
Mysqli_queries0.003212.704730.0011
Looping result0.00000.071910.0000
Template Total0.00114.310.0011
Template load0.00083.234910.0008
Template processing0.00020.992710.0002
Override
Cache load0.00062.258510.0006
General
dbfile0.00228.750280.0003
String conversion0.00000.035540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs