Skip to content

Commit

Permalink
修复predis长连接断开问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bingcool committed Jan 4, 2019
1 parent f5442a6 commit 119d063
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion score/Core/Cache/Predis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

/**
Expand Down

0 comments on commit 119d063

Please sign in to comment.