Skip to content

Commit d15bfa8

Browse files
committed
$initialTtl
1 parent e30708d commit d15bfa8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/RoadRunnerStore.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ final class RoadRunnerStore implements SharedLockStoreInterface
1616
{
1717
public function __construct(
1818
private readonly RrLockInterface $rrLock,
19+
private float $initialTtl = 300.0,
1920
) {
2021
}
2122

2223
public function save(Key $key): void
2324
{
2425
\assert(false === $key->hasState(__CLASS__));
2526
try {
26-
$lockId = $this->rrLock->lock((string) $key);
27+
$lockId = $this->rrLock->lock((string) $key, null, $this->initialTtl);
2728
if (false === $lockId) {
2829
throw new LockConflictedException('RoadRunner. Failed to make lock');
2930
}
@@ -36,7 +37,7 @@ public function save(Key $key): void
3637
public function saveRead(Key $key): void
3738
{
3839
\assert(false === $key->hasState(__CLASS__));
39-
$lockId = $this->rrLock->lockRead((string)$key);
40+
$lockId = $this->rrLock->lockRead((string)$key, null, $this->initialTtl);
4041
if (false === $lockId) {
4142
throw new LockConflictedException('RoadRunner. Failed to make read lock');
4243
}

0 commit comments

Comments
 (0)