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