expiry
Joshua Thijssen
jthijssen at noxlogic.nl
Fri May 26 12:24:39 UTC 2006
> Something like this then:
>
> memcache->set($key, $val, $expiry);
> memcache->get($key);
> memcache->set($key, $val, $expiry);
Yes, which is the way we do it now, but of course this creates a lot of
overhead. I'm not sure if it's possible to do it, but on a item-read,
the expiry-timestamp could be updated by adding the (relative)
expiry-time to the current time.
The main advantage I think this would have, is that you can add many
items to your cache, but that only the currently mostly-used items are
kept, thus saving a lot of memory.
For instance: You store user comments for blog-articles inside the
cache. The comments that are not read in the last 7 days could be
removed from the cache. Even if somebody reads the comment, it is
fetched from DB, stored in cache again, until it expires again.
More information about the memcached
mailing list