mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Decouple LocateVisitsCommand from AbstractLockedCommand
This commit is contained in:
27
module/CLI/src/Command/Util/LockConfig.php
Normal file
27
module/CLI/src/Command/Util/LockConfig.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user