Skip to content

Commit a946656

Browse files
committed
Fixed #689
1 parent da68281 commit a946656

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

lib/Phpfastcache/Drivers/Predis/Config.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ class Config extends ConfigurationOption
5555
*/
5656
protected $timeout = 5;
5757

58+
/**
59+
* @var bool
60+
*/
61+
protected $persistent = false;
62+
5863
/**
5964
* @return string
6065
*/
@@ -196,4 +201,22 @@ public function setTimeout(int $timeout): self
196201
$this->timeout = $timeout;
197202
return $this;
198203
}
204+
205+
/**
206+
* @return bool
207+
*/
208+
public function isPersistent(): bool
209+
{
210+
return $this->persistent;
211+
}
212+
213+
/**
214+
* @param bool $persistent
215+
* @return Config
216+
*/
217+
public function setPersistent(bool $persistent): Config
218+
{
219+
$this->persistent = $persistent;
220+
return $this;
221+
}
199222
}

lib/Phpfastcache/Drivers/Predis/Driver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ protected function driverConnect(): bool
8282
if (!empty($this->getConfig()->getPath())) {
8383
$this->instance = new PredisClient([
8484
'scheme' => 'unix',
85+
'persistent' => $this->getConfig()->isPersistent(),
8586
'timeout' => $this->getConfig()->getTimeout(),
8687
'path' => $this->getConfig()->getPath(),
8788
], $options);

0 commit comments

Comments
 (0)