public function touch($key, $expire)
{
/*
* Since \Memcached has no reliable touch(), we might as well take an
* easy approach where we can. If TTL is expired already, just delete
* the key - this only needs 1 request.
*/
if ($expire < 0 || $expire > 2592000 && $expire < time()) {
return $this->delete($key);
}
/*
* HHVM doesn't support touch.
* @see http://docs.hhvm.com/manual/en/memcached.touch.php
*
* PHP does, but only with \Memcached::OPT_BINARY_PROTOCOL == true,
* and even then, it appears to be buggy on particular versions of
* Memcached.
*
* I'll just work around it!
*/
$value = $this->get($key, $token);
return $this->cas($token, $key, $value, $expire);
}