Output Cache API Change

From: Date: Wed, 28 Feb 2001 14:03:09 +0000
Subject: Output Cache API Change
Groups: php.pear 
Request: Send a blank email to php-pear+get-1509@lists.php.net to get a copy of this message
Hi, Christian should not have given me a CVS account for the Output Cache, I changed the API ;-). Here're the thought behind the new API. The old gave you a script that looks like: $cache = new cache(...); if ($cache->Start()) { // do the long time computation if neccessary } // output the stuff $cache->End() I applied some changes to that you now can do this to cache a whole script. This is a very handy way if you place the cache control stuff in the auto_prepend and auto_append file: $cache = new cache(...) if ($content = $cache->Start()) { print $content; // WARNING: script executions stops! die(); } // do the long time computation print $cache->End(); You can still get the old behaviour (to cache parts of a script) by: $cache = new cache(...) if (!($content = $cache->Start()) { // do the long time computation print $cache->End() } else print $content; } I think this a good change that gives many users that do not have access to a php interpreter with one of the caches (Bware, APC, Zend) a quick and easy way to cache entire scripts. See the code http://cvs.nomad.ch/index.cgi/pear/Cache/Output.php for more detailed informations. Ulf

« previous php.pear (#1509) next »