diff --git a/CHANGELOG.md b/CHANGELOG.md index ef71070..45e21ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog][keepachangelog] and this project adher - Fixed the `$ttl` in the `increment` method - The `forever` method passed `$seconds` as 0, `Spiral\RoadRunner\KeyValue` summed `timestamp + 0`, and `forever` was not `forever` - When using `prefix`, the `many` method returns values with `prefix` +- The `Spiral\RoadRunner\KeyValue\Cache` class will set the value regardless of whether it exists or not - it always resolves the lock, you need to check for the existence of the key using the `has` method [#147]:https://github.com/roadrunner-php/laravel-bridge/issues/147 diff --git a/src/Cache/RoadRunnerLock.php b/src/Cache/RoadRunnerLock.php index 6b41f4e..a9af580 100644 --- a/src/Cache/RoadRunnerLock.php +++ b/src/Cache/RoadRunnerLock.php @@ -25,6 +25,10 @@ public function __construct( */ public function acquire() { + if ($this->storage->has($this->name)) { + return false; + } + return $this->storage->set( $this->name, $this->owner,