Decouple LocateVisitsCommand from AbstractLockedCommand

This commit is contained in:
Alejandro Celaya
2025-12-15 14:55:06 +01:00
parent 0f3f9d53c9
commit 96d122bcbf
6 changed files with 59 additions and 23 deletions

View 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);
}
}