RE: [PEAR] quick cache question

From: Date: Wed, 14 Nov 2001 10:12:37 +0000
Subject: RE: [PEAR] quick cache question
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-507@lists.php.net to get a copy of this message
> GM> Is there a right way to manage caching and expired files that > I've missed? > > I'm not sure it's the "right" way, but I use it like the following : > > <?php > require_once 'Cache/Output.php'; > $cache = new Cache_Output('file', array('cache_dir' => > '/var/www/cache/')); > $cacheHandle = $cache->generateID('id_key'); > if (!($content = $cache->start($cacheHandle))) { > // my stuff begins here > ... > // my stuff ends here > echo $cache->end(60*60*24); > } else { > echo $content; > } > > Of course, replace 'id_key' by whatever you want, and "60*60*24" by > your own cache timeout. > Hmm this is wierd. Tried it this way and inserting a 'CACHE HIT' and 'CACHE MISS' in the relevant spots to see what happens. The first time out I get no output. When I refresh the page I get both sets of data - both 'CACHE MISS' and 'CACHE HIT' on the same page. Then when the cache expires and it has to re-render the page I get no output again. I wonder if my CVS copy of PHp is borked or if there is some odd IT[X] interaction going on. Any thoughts? Cheers, Graeme

« previous php.pear.general (#507) next »