Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.8.3

Request #6681 Extending life of a cache file
Submitted: 2006-02-03 10:17 UTC
From: alex at vegagames dot net Assigned: fab
Status: Closed Package: Cache_Lite (version 1.6.0)
PHP Version: 4.3.10 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 38 - 8 = ?

 
 [2006-02-03 10:17 UTC] alex at vegagames dot net
Description: ------------ Greetings, it would be very useful for me to have something like a extendLife($time) method. The idea is that I have 1 filecache/user on my website (to cache some data rarely used that shouldn't be store in $_SESSION). As long as they're connected (it can vary from 30 seconds to 1 hour) I don't want the cache file to be removed. But as there is a lot of hourly connections I don't want to set a 1 hour life, I'd rather use ->extendLife($time) or whatever each time the cache is valid. Example : include_once("PEAR/Cache/Lite.php"); $cache = new Cache_Lite(array( "lifeTime" => 10 * 60, "automaticCleaningFactor" => 1000, "hashedDirectoryLevel" => 2 )); if ($data = $cache->get($iduser)) { ... $cache->extendLife(15*60); // extend life with another 10 minutes } else { // Regenerate data } Is there a way to do it right now ? Thank you in advance Take care

Comments

 [2006-02-04 12:56 UTC] fab at php dot net
I think it's easy to implement this, i will try to add into 1.7.0 beta 2
 [2006-02-04 14:00 UTC] alex at vegagames dot net
Great ! I really appreciate it :)
 [2006-02-04 17:13 UTC] fab at php dot net
Ok extendLife() is implemented in CVS but without the lifetime argument (technical reasons). When called, the cache is "touched", so it will be ok for another lifeTime period.
 [2006-02-04 17:13 UTC] fab at php dot net
 [2006-02-04 17:13 UTC] fab at php dot net
fixed in CVS
 [2006-02-04 18:09 UTC] alex at vegagames dot net
Extra cool, i'm going to test it this week-end, thanks for the extra fast reply and changes :)