Skip to content

Commit

Permalink
Fix edge case issues with Redis
Browse files Browse the repository at this point in the history
Closes #103
  • Loading branch information
GrahamCampbell committed Dec 4, 2023
1 parent fadb939 commit 927527d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGE LOG
## V10.1 (04/12/2023)

* Added PHP 8.3 support
* Fix edge case issues with Redis


## V10.0 (07/03/2023)
Expand Down
6 changes: 1 addition & 5 deletions src/Throttler/CacheThrottler.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ public function count(): int

$this->number = (int) $this->store->get($this->key);

if (!$this->number) {
$this->number = 0;
}

return $this->number;
}

Expand All @@ -166,7 +162,7 @@ private function hitRedis(): void
'if v>1 then return v '.
'else redis.call(\'setex\', KEYS[1], ARGV[1], 1) return 1 end';

$this->number = $this->store->connection()->eval($lua, 1, $this->computeRedisKey(), $this->time);
$this->number = (int) $this->store->connection()->eval($lua, 1, $this->computeRedisKey(), $this->time);
}

/**
Expand Down

0 comments on commit 927527d

Please sign in to comment.