src/Stiphle/Storage/Memcached.php
public function lock($key)
    {
        $key = $key . "::LOCK";
        $start = microtime(true);
        
        while(!$this->memcached->add($key, true, $this->ttl)) {
            $passed = (microtime(true) - $start) * 1000;
            if ($passed > $this->lockWaitTimeout) {
                throw new LockWaitTimeoutException();
            }
            usleep($this->sleep);
        }

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

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

If we're using storage, we might have multiple requests coming in at
once, so we lock the storage

@return void
Lock