[PEAR-BUG] Req #17269 [Com]: Extend Cache_Lite::lastModified() take a cache_id to return the age of an entry

[email protected] ("[email protected]")
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=17269&edit=1

 ID:               17269
 Comment by:       [email protected]
 Reported By:      john at stoffel dot org
 Summary:          Extend Cache_Lite::lastModified() take a cache_id to
                    return the age of an entry
 Status:           Open
 Type:             Feature/Change Request
 Package:          Cache_Lite
 PHP Version:      Irrelevant
 Roadmap Versions: 
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2010-06-09 10:39:50] hm2k

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.

------------------------------------------------------------------------

[2010-03-25 21:17:16] tacker

-PHP Version: 5.2.6
+PHP Version: Irrelevant


------------------------------------------------------------------------

[2010-03-25 20:25:10] l8gravely

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.

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=17269&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.