} public function refresh(float
$ttlInSecond = null
): void
{ if (!
$ttlInSecond ??=
$this->ttlInSecond
) { throw new InvalidArgumentException('You have to define an expiration duration.'
);
} try { $this->key->
resetLifetime();
$this->store->
putOffExpiration($this->key,
$ttlInSecond);
$this->key->
reduceLifetime($ttlInSecond);
$this->dirty = true;
$this->logger?->
debug('Expiration defined for "{resource}" semaphore for "{ttlInSecond}" seconds.',
['resource' =>
$this->key, 'ttlInSecond' =>
$ttlInSecond]);
} catch (SemaphoreExpiredException
$e) { $this->dirty = false;
$this->logger?->
notice('Failed to define an expiration for the "{resource}" semaphore, the semaphore has expired.',
['resource' =>
$this->key
]);
throw $e;
} catch (\Exception
$e) {