Skip to content

Commit 50fbc8a

Browse files
author
Mohammed Karim
committed
Change MockHandler to return null instead of false to be similar to other CacheHandlers.
Update Throttler to check for null instead of false when looking for existing bucket.
1 parent 8e0ab84 commit 50fbc8a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

system/Throttle/Throttler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function check(string $key, int $capacity, int $seconds, int $cost = 1):
138138
$tokenName = $this->prefix . $key;
139139

140140
// Check to see if the bucket has even been created yet.
141-
if (($tokens = $this->cache->get($tokenName)) === false)
141+
if (($tokens = $this->cache->get($tokenName)) === null)
142142
{
143143
// If it hasn't been created, then we'll set it to the maximum
144144
// capacity - 1, and save it to the cache.

tests/_support/Cache/Handlers/MockHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function get(string $key)
4343

4444
return array_key_exists($key, $this->cache)
4545
? $this->cache[$key]
46-
: false;
46+
: null;
4747
}
4848

4949
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)