diff --git a/score/Core/Cache/Predis.php b/score/Core/Cache/Predis.php index 59f3a4e4..115f138f 100644 --- a/score/Core/Cache/Predis.php +++ b/score/Core/Cache/Predis.php @@ -92,7 +92,12 @@ public function __call(string $method, array $args) { */ public function __destruct() { // 断开并销毁redis的socket - $this->Predis->disconnect(); + if(isset($this->parameters['persistent'])) { + $persistent = filter_var($this->parameters['persistent'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + if(!$persistent) { + $this->Predis->disconnect(); + } + } } /**