Re: [SMARTY-DEV] Cache Handling

From: Date: Mon, 17 Jun 2002 14:45:52 +0000
Subject: Re: [SMARTY-DEV] Cache Handling
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-151@lists.php.net to get a copy of this message
I swapped around cache_id and compile_id order. display('index.tpl','cache_id','compile_id1'); display('index.tpl','cache_id','compile_id2'); clear_cache(null,'cache_id'); This will clear both template caches. However, this will not clear them both: clear_cache('index.tpl','cache_id'); Any time you supply a template name, it looks for an exact match on both cache_id and compile_id. You must use 'null' for the template name if you want to clear groups of files. Monte Andreas Kossmeier wrote:
Monte Ohrt wrote:
Make your compile ids like this: lang|en lang|fr lang|de Then to clear all of them, use clear lang.
why should this solve the problem? these are compile IDs. usually you want to clear a cache by a given cacheID, and the linked compiled representations (also cache files) should also be affected.
why? the reason for all this was the ability to easily clear grouped template representations. imagine a multi-language template for english, french and german (compile IDs). if the data changes, you have to clear the cache files for all languages (compileIDs). with compileID on top level, this isn't possible without searching.
maybe a more practical example would help: how would you clear representations of an event box (based on e.g. data 23) with different languages (compileIDs)? /de/eventbox/23/events.html /en/eventbox/23/events.html vs. /eventbox/23/events.html/de /eventbox/23/events.html/en the cacheid is more important than the compileID, the hierarchical cacheID can group related data together, and the different compiled versions have to be under that, so that they are also affected when e.g. "eventbox|23" is cleared (they are all based on the *same* cached data!) andreas
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.dev (#151) next »