public function lock($key)
{
$key = $key . "::LOCK";
$start = microtime(true);
while (!apc_add($key, true, $this->ttl)) {
$passed = (microtime(true) - $start) * 1000;
if ($passed > $this->lockWaitTimeout) {
throw new LockWaitTimeoutException();
}
usleep($this->sleep);
}
return;
}