mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-05 06:43:12 +08:00
28 lines
589 B
PHP
28 lines
589 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shlinkio\Shlink\CLI\Command\Util;
|
|
|
|
final class LockedCommandConfig
|
|
{
|
|
public const DEFAULT_TTL = 600.0; // 10 minutes
|
|
|
|
private function __construct(
|
|
public readonly string $lockName,
|
|
public readonly bool $isBlocking,
|
|
public readonly float $ttl = self::DEFAULT_TTL,
|
|
) {
|
|
}
|
|
|
|
public static function blocking(string $lockName): self
|
|
{
|
|
return new self($lockName, true);
|
|
}
|
|
|
|
public static function nonBlocking(string $lockName): self
|
|
{
|
|
return new self($lockName, false);
|
|
}
|
|
}
|