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

Request #17269 Extend Cache_Lite::lastModified() take a cache_id to return the age of an entry
Submitted: 2010-03-26 00:25 UTC
From: l8gravely Assigned:
Status: Open Package: Cache_Lite
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2010-03-26 00:25 UTC] l8gravely (John Stoffel)
Description: ------------ Hi, I'd like to suggest that the Cache_Lite::lastModified() take a new arguement, which is the id of a cached object. The return value would be the same as currently defined, though if the id did not exist, it should return -1, or some other error code. This would allow me to pre-populate my web site with data which takes a long time to generate, and yet easily query the cache to see if I need to re-generate the output. Another thought would be to extend some of the other existing methods to take a datestring which they check the cache file age against. If the cache is older than the date string, return false (and clear that entry) otherwise just return the cached entry. This could be: Cache_Lite_Output::start( string $id , string $group = 'default' , boolean $doNotTestCacheValidity = false, int older = '0') where it checks if the age of the cached file is less than 'older' and returns False if true.

Comments

 [2010-03-26 01:17 UTC] tacker (Markus Tacker)
-PHP Version: 5.2.6 +PHP Version: Irrelevant
 [2010-06-09 14:39 UTC] hm2k (James Wade)
The documentation for lastModified() is lacking, so assuming it doesn't do this already (i've not checked), this feature should be added as standard.
 [2011-08-27 09:29 UTC] ivonascimento (Ivo Nascimento)
To get a file info you need both id and group information, so I suggest added both as parameters to lasModified. Your second request I believe is part off your logic and not part of the package. get the age information and recreate the cache in a same method make this method a lot specify use lasModified method ( if the patch was accept) and then, if it has invalid, recreate it.
 [2011-08-27 09:30 UTC] ivonascimento (Ivo Nascimento)