Re: What can prematurely expire a cache?

From: Date: Thu, 03 Jan 2002 14:36:33 +0000
Subject: Re: What can prematurely expire a cache?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2489@lists.php.net to get a copy of this message
* caching disabled * $force_compile = true * $compile_check = true and involved template was modified * cache lifetime expires * programatically removing cache files * manually removing files from cache_dir Thats what I can think of off the top of my head. "Brian E. Lozier" wrote: > > I'm still struggling with the caching problem mentioned in the last few emails. So my > question now is, what > exactly can expire a cache? Why would a cache of index.tpl be expired after accessing an > unrelated page > that doesn't even reference index.tpl? I tested sample code and it SEEMS to work correctly > in my test... but > the code is virtually identical (only difference is that the big script gets data from a > database and the > other doesn't). Here is the code that doesn't work: > http://www.massassi.org/saberworks/source.phps and > here's the test code that works: > > // Classes > include_once('classes/template.php'); > > // Start the template > $tpl = new Template; > $tpl->caching = true; > > // Assign Title (in testmain.tpl) > $tpl->assign('Title', 'A simple cache test.'); > > // Put some dynamic content in testmain.tpl > if($tpl->is_cached('testcache3.tpl', $cache_id)) { > echo '<p>This is cached.</p>'; > $tpl->assign('Cached', 'Yes'); > } > else { > echo '<p>This is not cached.</p>'; > $tpl->assign('Cached', 'No'); > } > > // Assign the content... this should fetch the cached copy > // by default if it's not expired > $tpl->assign('Content', $tpl->fetch('testcache3.tpl', $cache_id)); > > // Set caching to false for the display of testmain.tpl > // This is so the dynamic content of testmain.tpl isn't cached! > $tpl->caching = false; > $tpl->display('testmain.tpl'); > > Brian > ------------------------------------ > "How should I know if it works? That's what beta testers are for. I only coded > it." - Linus Torvalds > > --- > 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 (#2489) next »