재 업데이트

This commit is contained in:
2020-01-28 01:17:00 +09:00
parent a8b3befca9
commit ddb971e41e
413 changed files with 13446 additions and 16025 deletions
+5 -8
View File
@@ -20,14 +20,14 @@ final class Key
{
private $resource;
private $expiringTime;
private $state = array();
private $state = [];
public function __construct(string $resource)
{
$this->resource = $resource;
}
public function __toString()
public function __toString(): string
{
return $this->resource;
}
@@ -60,7 +60,7 @@ final class Key
/**
* @param float $ttl the expiration delay of locks in seconds
*/
public function reduceLifetime($ttl)
public function reduceLifetime(float $ttl)
{
$newTime = microtime(true) + $ttl;
@@ -74,15 +74,12 @@ final class Key
*
* @return float|null Remaining lifetime in seconds. Null when the key won't expire.
*/
public function getRemainingLifetime()
public function getRemainingLifetime(): ?float
{
return null === $this->expiringTime ? null : $this->expiringTime - microtime(true);
}
/**
* @return bool
*/
public function isExpired()
public function isExpired(): bool
{
return null !== $this->expiringTime && $this->expiringTime <= microtime(true);
}