return;
} $this->
release();
} public function acquire(): bool
{ try { $this->key->
resetLifetime();
$this->store->
save($this->key,
$this->ttlInSecond
);
$this->key->
reduceLifetime($this->ttlInSecond
);
$this->dirty = true;
$this->logger?->
debug('Successfully acquired the "{resource}" semaphore.',
['resource' =>
$this->key
]);
return true;
} catch (SemaphoreAcquiringException
) { $this->logger?->
notice('Failed to acquire the "{resource}" semaphore. Someone else already acquired the semaphore.',
['resource' =>
$this->key
]);
return false;
} catch (\Exception
$e) { $this->logger?->
notice('Failed to acquire the "{resource}" semaphore.',
['resource' =>
$this->key, 'exception' =>
$e]);