Skip to content

Commit 7d1f21a

Browse files
tweaks
1 parent da2c837 commit 7d1f21a

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

INSTALL.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ exception functions required by this class.
4343

4444
Once those two dependencies are installed, there are two class files:
4545

46-
1. [`SimpleCacheRedis`](blob/master/lib/SimpleCacheRedis.php)
47-
2. [`SimpleCacheRedisSodium`](blob/master/lib/SimpleCacheRedisSodium.php)
46+
1. [`SimpleCacheRedis`](lib/SimpleCacheRedis.php)
47+
2. [`SimpleCacheRedisSodium`](lib/SimpleCacheRedisSodium.php)
4848

4949
The first class provides PSR-16 without encryption, the second provides PSR-16
5050
with encryption.

USAGE.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ For simple cases where Redis is running on the same server, this usually works:
3333
$redis = new \Redis();
3434
$redis->connect('127.0.0.1', 6379);
3535

36-
If you need more complexity than that, see the PECL class documentation.
36+
If you need more complexity than that, see the PECL class documentation. Once
37+
you have that object, you can create an instance of the `SimpleCacheRedis`
38+
class.
3739

38-
The easiest way to create an object of the SimpleCacheRedis class:
40+
The easiest way to create an object of the `SimpleCacheRedis` class:
3941

4042
use \AWonderPHP\SimpleCacheRedis\SimpleCacheRedis as SimpleCache;
4143
$CacheObj = new SimpleCache($redis);
4244

4345
Note that the `$redis` argument is passed as the first argument to the
44-
constructorm, it is *required*.
46+
constructor, it is *required*.
4547

4648
__**NOTE:**__ To use the encrytion enabled version of this class, use the class
4749
`SimpleCacheRedisSodium` instead of `SimpleCacheRedis`. Also, that variant of

lib/SimpleCacheRedis.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,13 @@ public function has($key): bool
222222
$key = $this->adjustKey($key);
223223
if ($this->enabled) {
224224
$rs = $this->redis->exists($key);
225+
// pecl-redis 3.1.6 returns boolean
225226
if (is_bool($rs)) {
226227
return $rs;
227228
}
228-
if (is_int($rs)) {
229-
if ($rs === 1) {
230-
return true;
231-
}
229+
// pecl-redis 4.0.0 return integer
230+
if ($rs === 1) {
231+
return true;
232232
}
233233
}
234234
return false;

lib/SimpleCacheRedisSodium.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ public function has($key): bool
232232
$key = $this->adjustKey($key);
233233
if ($this->enabled) {
234234
$rs = $this->redis->exists($key);
235+
// pecl-redis 3.1.6 returns boolean
235236
if (is_bool($rs)) {
236237
return $rs;
237238
}
238-
if (is_int($rs)) {
239-
if ($rs === 1) {
240-
return true;
241-
}
239+
// pecl-redis 4.0.0 return integer
240+
if ($rs === 1) {
241+
return true;
242242
}
243243
}
244244
return false;

0 commit comments

Comments
 (0)