when using php + memcache(d) pecl extensions, is it possible to pull the remaining lifetime of an element using one of the built in memcache(d) functions?
i know this can be done by doing a full dump of the memcached base, parsing out the element one is after, and reading the timestamp. but this is a very heavy way of doing things.
another way i suppose this could be done is by setting the time added in the element itself, sort of like this:
$data=array('dateadded'=>time(),'data'=>$datatostore);
but once again, this seams slightly redundant.
btw, by memcache(d) i mean w开发者_如何转开发e have both the memcache extension installed (http://pecl.php.net/memcache) as well as the memcached one (http://pecl.php.net/memcached).
we use the memcached one for our actual code based stuff (set, read, remove, etc) and the memcache one for our sessions.
thanks!
No, this is not possible. Storing the expiration time with the data itself is probably your best bet if you need this info. See here also.
精彩评论