ZF-3508: API to get metadate for a given id
Description
It would be nice to have an API to read the meta data of a given cache entry (when was the item cached, what tags does the item have or maybe custom metadata).
Here is an example scenario: An application that displays financial data should be updated every minute. However if updated financial data is not available, the existing data should still be used for up to 4 hours along with a timestamp in red to display the time when the data was last updated.
For implement this, the cache TTL would be set to 4 hours. In the code the metadata would first be read to determine if the data is older than 1 minute. If so a request is made and the cache is updated if new data is available. Otherwise the current data will be read.
Ideally there would even be a way to write some more custom metadata like "lastchecked" so that the check if the data is older than 1 minute is only done every 30 seconds at most.
Comments
Posted by Fabien MARTY (fab) on 2008-07-05T05:45:02.000+0000
the test() method is a good solution for mtime
for other things, it requires big changes (but i agree with you)
Posted by Fabien MARTY (fab) on 2008-08-29T12:55:54.000+0000
just commited into SVN trunk new methods "touch($id, $extendedLifetime) or getMetadatas($id)" (for File and Apc backend only, for the moment)
can you try it ?
thanks
Posted by Fabien MARTY (fab) on 2008-09-06T09:45:59.000+0000
fixed in SVN trunk
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:15.000+0000
Changing issues in preparation for the 1.7.0 release.