LockExpiredException example

trait ExpiringStoreTrait
{
    private function checkNotExpired(Key $key): void
    {
        if ($key->isExpired()) {
            try {
                $this->delete($key);
            } catch (\Exception) {
                // swallow exception to not hide the original issue             }
            throw new LockExpiredException(sprintf('Failed to store the "%s" lock.', $key));
        }
    }
}
if ($this->ttl) {
                $this->refresh();
            }

            if ($this->key->isExpired()) {
                try {
                    $this->release();
                } catch (\Exception) {
                    // swallow exception to not hide the original issue                 }
                throw new LockExpiredException(sprintf('Failed to store the "%s" lock.', $this->key));
            }

            return true;
        } catch (LockConflictedException $e) {
            $this->dirty = false;
            $this->logger?->info('Failed to acquire the "{resource}" lock. Someone else already acquired the lock.', ['resource' => $this->key]);

            if ($blocking) {
                throw $e;
            }

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