Retrieving the age of a given key

Paul T pault12345 at yahoo.com
Fri Aug 18 22:08:05 UTC 2006


--- Anthony Volodkin <anthonyv at brainlink.com> wrote:

> 
> Wow, you guys are quick! Thank you!
> 
> Paul: It looks like your method should work well. 
> It also seems like I 
> can just prepend a timestamp to the string I am
> storing in memcache 
> (i.e. to the data) and remove it once I've retrieved
> the data, before 
> doing anything else with it (it's all HTML in this
> case anyway).

Yes, by storing the timestamp and looking at it every
get you would have the exact logic that your code
already has - only instead of fstat on the file you
will be doing one split and look at the datetime
attached to the data.

In 'my' method the get on expired object will not
marshall the blob (in your method the blob is always
fetched), but I think that this is very minor and
should not be an issue for your case. 

Maybe there is something else, but it seems that in
general storing the datetime in a data should work for
your case (because it already works for you ;-)

The only important difference would be that the files
don't disappear from file system but memcached will
push out the page if it has not enough memory in a
pool, but that should be no big deal because when you
get the miss - you just re-generate the page (I
suspect you already do that with the filesystem ;-)

Rgds.Paul.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the memcached mailing list