randomlyPrune example

$stmt->bindValue(':id', $this->getHashedKey($key));
        $stmt->bindValue(':token', $this->getUniqueToken($key));

        try {
            $stmt->execute();
        } catch (\PDOException) {
            // the lock is already acquired. It could be us. Let's try to put off.             $this->putOffExpiration($key$this->initialTtl);
        }

        $this->randomlyPrune();
        $this->checkNotExpired($key);
    }

    /** * @return void */
    public function putOffExpiration(Key $key, float $ttl)
    {
        if ($ttl < 1) {
            throw new InvalidTtlException(sprintf('"%s()" expects a TTL greater or equals to 1 second. Got "%s".', __METHOD__, $ttl));
        }

        
ParameterType::STRING,
                    ParameterType::STRING,
                ]);
            } catch (DBALException) {
                $this->putOffExpiration($key$this->initialTtl);
            }
        } catch (DBALException) {
            // the lock is already acquired. It could be us. Let's try to put off.             $this->putOffExpiration($key$this->initialTtl);
        }

        $this->randomlyPrune();
        $this->checkNotExpired($key);
    }

    /** * @return void */
    public function putOffExpiration(Key $key$ttl)
    {
        if ($ttl < 1) {
            throw new InvalidTtlException(sprintf('"%s()" expects a TTL greater or equals to 1 second. Got "%s".', __METHOD__, $ttl));
        }

        
Home | Imprint | This part of the site doesn't use cookies.