Skip to content

Commit 805678f

Browse files
committed
The forever method passed $seconds as 0, Spiral\RoadRunner\KeyValue summed timestamp + 0, and forever was not forever
Fixed the `increment' method
1 parent 231a23f commit 805678f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Cache/RoadRunnerStore.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ public function putMany(array $values, $seconds)
6060

6161
public function increment($key, $value = 1)
6262
{
63-
$data = $this->get($this->prefix . $key);
63+
$data = $this->get($key);
6464

6565
return tap(((int) $data) + $value, function ($newValue) use ($key): void {
6666
$ttl = $this->storage->getTtl($this->prefix . $key);
67-
$this->storage->set($key, $newValue, $ttl->diff(new \DateTimeImmutable()));
67+
68+
$this->put($key, $newValue, ($ttl ? $ttl->diff(new \DateTimeImmutable()) : null));
6869
});
6970
}
7071

@@ -75,7 +76,7 @@ public function decrement($key, $value = 1)
7576

7677
public function forever($key, $value)
7778
{
78-
return $this->put($key, $value, 0);
79+
return $this->put($key, $value, null);
7980
}
8081

8182
public function forget($key)

0 commit comments

Comments
 (0)