// Interface defines a float value but Store required an integer.
$ttl =
(int) ceil($ttl);
$token =
$this->
getUniqueToken($key);
[$value,
$cas] =
$this->
getValueAndCas($key);
$key->
reduceLifetime($ttl);
// Could happens when we ask a putOff after a timeout but in luck nobody steal the lock
if (\Memcached::RES_NOTFOUND ===
$this->memcached->
getResultCode()) { if ($this->memcached->
add((string) $key,
$token,
$ttl)) { return;
} // no luck, with concurrency, someone else acquire the lock
throw new LockConflictedException();
} // Someone else steal the lock
if ($value !==
$token) { throw new LockConflictedException();
}