public function add($key, $value, $expire = 0)
{
$ttl = $this->ttl($expire);
// negative TTLs don't always seem to properly treat the key as deleted
if ($ttl < 0) {
// don't add - it's expired already; just check if it already
// existed to return true/false as expected from add()
return $this->get($key) === false;
}
// lock required for CAS
if (!$this->lock($key)) {
return false;
}
$success = $this->apcu_add($key, $value, $ttl);
$this->expire($key, $ttl);
$this->unlock($key);
return $success;
}