Re: cache path / compile path / translation

From: Date: Wed, 25 Jul 2001 13:29:50 +0000
Subject: Re: cache path / compile path / translation
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1282@lists.php.net to get a copy of this message
Hans-Peter Oeri wrote: > > Hi! > > Sorry to bugger you again, but I really bit into that translation thing ;) > > I still prefer the translation by pre-filter and "rewrite magic" to the compile > path (that way, we can include vars/calls in the translated strings). > > Looking through the caching code, I found the somewhat strange encoding of > cache paths: lots of md5 there! Actually, I would suggest using something > like "urlencode" (as in the compile path) just for debugging reasons (at least > one does not only see weird codes...). We used md5 because it was filename safe, and it helped us to break up the cache files into sub-directories to help maintain potentially thousands of files, much like netscape handles its cache files. > Furthermore, the encoding is not in a > method, but recreated several times... Any reason for that one? laziness? :-) I suppose because it is done in two places and it is four lines of code, so we never bothered. We could break that into its own class method, it wouldn't hurt. > > Why not write a generic "filename plus some_id" encoding function that could be > used for the creation of the "compiled filename" as well as the "cache > filename"? The thing is, we want the cache files split up into sub-directories to help keep file access as quick as possible. We use the first two characters of the md5 hash to create this subdirectory name, so we can have a pseudo random way of creating directories. We could make the actual filenames a URL encoded name of some sort, but they would still be in random looking sub-directory names. > > I would not suggest to combine compile_id and cache_id into one, as this would > create a lot of overhead for those not needing different compiled files... Just > have to figure out a solution there w/o changing the API too much ;) > > Don't conform! > IkKampfCaspar75 > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.smarty.general (#1282) next »