Re: [SMARTY] How complex is your caching??

From: Date: Tue, 26 Aug 2003 16:06:22 +0000
Subject: Re: [SMARTY] How complex is your caching??
References: 1 2 3 4 5 6 7 8  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10126@lists.php.net to get a copy of this message
Hi, Here is an other proposition to prevent memory fill up by differnt cacheids. This script count the size of every template output and add this value to a variable. If the size of this variable > 100000 the cache is deleted. It's not a first class test but it prevent from the worst case. /* cache_memory.php contains a single variable. */ $output = $tpl->fetch( 'index.tpl', $_cache_id); if($not_cached === TRUE) { include 'configs/cache_memory.php'; $mem = $cache_memory + strlen($output); if($mem > 100000) { $tpl->clear_all_cache(); $mem = 0; } $_mem_content = "<?php \$cache_memory={$mem}; ?>"; $_fp = fopen('configs/cache_memory.php',"w"); $_action = fwrite($_fp,$_mem_content); fclose($_fp); } ----- Original Message ----- From: "Wom.bat" <wom.bat@gmx.net> To: "atu" <atu@a-tu.net> Cc: <smarty-general@lists.php.net> Sent: Tuesday, August 26, 2003 3:00 PM Subject: Re: [SMARTY] How complex is your caching?? > On Tuesday, August 26, 2003 2:48 PM +0200, atu wrote: > > Thanks Wom.bat, > > > > I'm searching for an more efficient way than checking if the > > requested item exists. > > ex.: > > index.php?id_doc=2435 > > One way is to check if an item id_doc=2435 exists. If there are more > > variables in the url you have to do a lot of checks. > > > > I'am searching for an other checking system. I mean more simple but > > efficient. > > What about to mesure the memory waste. > > Or if you know how many items you have in your db you can compare > > this value with the value of different cache items. > > > http://lists.php.net/article.php?group=php.smarty.general&article=10031 > :) > use cache groups, that helps :) > > and never trust user input ;) > > hth > David > > > > > ----- Original Message ----- From: "Wom.bat" <wom.bat@gmx.net> To: "atu" <atu@a-tu.net> Cc: <smarty-general@lists.php.net> Sent: Tuesday, August 26, 2003 3:00 PM Subject: Re: [SMARTY] How complex is your caching?? > On Tuesday, August 26, 2003 2:48 PM +0200, atu wrote: > > Thanks Wom.bat, > > > > I'm searching for an more efficient way than checking if the > > requested item exists. > > ex.: > > index.php?id_doc=2435 > > One way is to check if an item id_doc=2435 exists. If there are more > > variables in the url you have to do a lot of checks. > > > > I'am searching for an other checking system. I mean more simple but > > efficient. > > What about to mesure the memory waste. > > Or if you know how many items you have in your db you can compare > > this value with the value of different cache items. > > > http://lists.php.net/article.php?group=php.smarty.general&article=10031 > :) > use cache groups, that helps :) > > and never trust user input ;) > > hth > David > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

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