Retrieving the age of a given key

Anthony Volodkin anthonyv at
Fri Aug 18 19:45:36 UTC 2006


Is there any way to get the age of a given key when you retrieve it from memcache?

A portion of my app currently uses disk-based caching to store the HTML 
generated from dynamic pages.  A major update is "published" on the site once an 
hour and at that point the code knows not to use the cached files and 
overwrites them with new data as requests come in.  This is implemented by 
checking modification times of the cache files vs another datetime value.

I want to start using memcached for this instead of the disk.

To make it work, I would need to know the age of any given key.  Using the 
more-traditional expiration feature of memcached can lead to having an 
inconsistent set of data.  It would also be very difficult to 
flush the appropriate keys as these hourly updates are published.

What do you guys think?

Thank you,


More information about the memcached mailing list