ldc-cocotte/shared/Concurrency/Lock.php

24 lines
402 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Shared\Concurrency;
interface Lock
{
/**
* @template T
*
* @param callable(): T $callback
* @return T
*
* @throws \Shared\Concurrency\LockTimeoutException
*/
public function synchronize(
string $key,
callable $callback,
int $ttlSeconds = 30,
int $waitSeconds = 10,
): mixed;
}