Re: [PHP-PEAR] Output_Cache Module
[email protected] (Christian Stocker) Sat, 24 Feb 2001 12:28:33 +0100 (CET)
| Newsgroups | php.pear |
|---|---|
| Organization | Phant! - http://phant.ch |
| Message-ID | <[email protected]> |
On Yesterday, Jesus M. Castagnetto wrote:
> I think you might also want to add some locking
> mechanism when caching to a file, in this way 2
> different script instances will not get into a race
> condition.
how good is the flock()-function from php for that? there was something
written in the manual, that this is not usable on every situation. someone
has more information on that?
> It might not belong in the design you are using, but
> checking for validity of the data will also be
> important, so the caching will happen automagically
> when the data changes. Assuming that the script is
> pulling data from a source that can be checked using a
> timestamp or an MD5 hash, etc.
maybe as an additional feature i can imagine that. but calculating a md5
hash every time has some speed penalties... in our application, all the
relevant content data comes out of a database, so maybe a timestamp could
be useful for that :) but at the moment we just delete the appropriate
cache-file/entry, when we change the content of the pages -> no checking
of validity needed. But i can see the use for that...
> Caching different output depending on variables will
> be also useful. So, for example, you could cache info
> from a page that generates different ouput depending
> on the user type (admin, guest, etc.)
in our application again (for which i wrote this caching stuff ) , we
generate every page with xml/xslt (xml is generated from a mysql db...).
The whole public part of the site is just generated with one php file. it
takes the appropriate xml & xslt file depending on which variables where
passed (done with apache rewrite stuff so it looks like just different
directories for the user), then the URL is taken for generating the hash.
if we want now to have different views for the same URL we just add some
parameters to the URL when the caching starts, so for example
$cache->Start("http://somewhere.org/section/subsection/&guest"). With this
method we have different cached files for the different views we want and
we don't need to pass variables, which have to be parsed again... it just
generates another file/db-entry/whatever-storage-system-you-use with a
different md5 hash.
i hope this was not to confusing...
> I wrote someting along these lines over a year ago (I
> mentioned this before), released the code on June last
> year, and have contended with some of the issues
> above.
i'll definitively will have a look.
chregu
--
nam...christian stocker adr...bremgartnerstr. 66, ch-8003 zurich
pho...+41 1 451 6021 www...http://phant.ch/chregu
mob...+41 76 561 8860 [email protected]