Forums / Install & configuration / Static cache - publishing doesn't update static cache

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.