Stiphle\Storage\Apc::lock PHP Метод

lock() публичный Метод

If we're using storage, we might have multiple requests coming in at once, so we lock the storage
public lock ( $key ) : void
Результат void
    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;
    }