[Patch] Cache handler overhaul

From: Date: Sun, 15 Oct 2006 23:54:24 +0000
Subject: [Patch] Cache handler overhaul
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2903@lists.php.net to get a copy of this message
Hi, First-time contributor, so let me know if I'm doing anything wrong. I've done some coding to change the way Smarty works with cache handlers. Right now, there are several flaws with using an alternative cache handler (like the MySQL or eAccelerator examples that have been floating around): * Much of the data that's cached in Smarty's cache files (such as expiration data) isn't sent to the cache handler * is_cached only checks if Smarty has a cache file, regardless of what the cache handler is * All of the cache handler code I've seen doesn't, well, actually work with the current version of Smarty I've done a rewrite so that these problems are fixed, cache handlers can respond to 'check' calls for is_cached (in addition to 'read', 'write' and 'clear' calls), and so that multiple cache handlers can be put in an array to be called sequentially. This would be useful if you had a site with a huge amount of cached data in Smarty and you wanted to, say, try a memory cache first, then a hard disk cache if the memory cache failed. I've written a Memcached cache handler that demonstrates this. The code could use some cleaning up, but it seems to work reliable and doesn't break any existing functionality (unless, possibly, you were already using an alternative cache handler; you will have to modify it). .diff is attached, as is the Memcached handler. Trevor Burnham

Attachment: [text/php] SmartyMemcached.class.php
« previous php.smarty.dev (#2903) next »