Skip to content

Commit 491b0f2

Browse files
committed
fix: patch up connection and types
1 parent 823287b commit 491b0f2

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/Redis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected function parseSaveOptions()
143143
* @link https://redis.io/commands/set
144144
* @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example
145145
*/
146-
public function set($key, $value = "", $timeout = null)
146+
public function set($key, $value = "", $timeout = 0)
147147
{
148148
return $this->connection()->set($key, $value, $timeout);
149149
}
@@ -245,7 +245,7 @@ public function close()
245245
*/
246246
public function connection(): Adapter
247247
{
248-
if (!$this->redis) {
248+
if (!$this->redis->connection()) {
249249
$this->redis->connect($this->config);
250250
}
251251

src/Redis/Adapter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ public function ping(?string $message = null);
8080
*/
8181
public function errors(): array;
8282

83+
/**
84+
* Get the redis connection
85+
*
86+
* @return mixed
87+
*/
88+
public function connection();
89+
8390
/**
8491
* Close the redis connection
8592
*

src/Redis/Native.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public function errors(): array
8989
return $this->errors;
9090
}
9191

92+
public function connection()
93+
{
94+
return $this->redis;
95+
}
96+
9297
public function close()
9398
{
9499
$this->redis->close();

src/Redis/Predis.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public function errors(): array
8686
return $this->errors;
8787
}
8888

89+
public function connection()
90+
{
91+
return $this->redis;
92+
}
93+
8994
public function close()
9095
{
9196
$this->redis->disconnect();

0 commit comments

Comments
 (0)