Lost - Not the TV show…. Although… I do enjoy it.


May 14, 2007


Tags: ,

For the three or four other people out there who are actually using memcached having problems using the set function because of expiration issues — expiration time is handled differently for anything over 30 days (as it was for us trying to make a year-long session here at Plaxo):

$memd->set($key, $value[, $exptime]);Unconditionally sets a key to a given value in the memcache. Returns true if it was stored successfully.

The $key can optionally be an arrayref, with the first element being the hash value, as described above.

The $exptime (expiration time) defaults to “never” if unspecified. If you want the key to expire in memcached, pass an integer $exptime. If value is less than 60*60*24*30 (30 days), time is assumed to be relative from the present. If larger, it’s considered an absolute Unix time.


The function has one of the strangest overloaded behaviors I’ve seen in a widely used structure. So, if you ever want a key to last longer than 30 days, you gotta make it a unix timestamp!

RSS feed for comments on this post. TrackBack URL

Leave a comment

XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>