What can prematurely expire a cache?

From: Date: Thu, 03 Jan 2002 00:52:05 +0000
Subject: What can prematurely expire a cache?
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2478@lists.php.net to get a copy of this message
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

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