chg: [internal] Make Redis connection static

pull/7015/head
Jakub Onderka 2021-02-15 18:28:41 +01:00
parent ab1808a1ed
commit 1ac21e04c6
1 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,8 @@ class AppModel extends Model
public $inserted_ids = array();
private $__redisConnection = null;
/** @var null|Redis */
private static $__redisConnection = null;
private $__profiler = array();
@ -2477,8 +2478,8 @@ class AppModel extends Model
*/
public function setupRedisWithException()
{
if ($this->__redisConnection) {
return $this->__redisConnection;
if (self::$__redisConnection) {
return self::$__redisConnection;
}
if (!class_exists('Redis')) {
@ -2503,7 +2504,7 @@ class AppModel extends Model
throw new Exception("Could not select Redis database $database: {$redis->getLastError()}");
}
$this->__redisConnection = $redis;
self::$__redisConnection = $redis;
return $redis;
}