1
1
Fork 0

Merge pull request #7510 from nupplaphil/bug/Fix_Redis_test

Fix Redis test
This commit is contained in:
Hypolite Petovan 2019-08-13 06:41:07 -04:00 committed by GitHub
commit f068d00645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,8 +37,10 @@ class RedisCache extends Cache implements IMemoryCache
$redis_pw = $config->get('system', 'redis_password'); $redis_pw = $config->get('system', 'redis_password');
$redis_db = $config->get('system', 'redis_db', 0); $redis_db = $config->get('system', 'redis_db', 0);
if (!$this->redis->connect($redis_host, $redis_port)) { if (isset($redis_port) && !$this->redis->connect($redis_host, $redis_port)) {
throw new Exception('Expected Redis server at ' . $redis_host . ':' . $redis_port . ' isn\'t available'); throw new Exception('Expected Redis server at ' . $redis_host . ':' . $redis_port . ' isn\'t available');
} elseif (!$this->redis->connect($redis_host)) {
throw new Exception('Expected Redis server at ' . $redis_host . ' isn\'t available');
} }
if (isset($redis_pw) && !$this->redis->auth($redis_pw)) { if (isset($redis_pw) && !$this->redis->auth($redis_pw)) {
@ -120,7 +122,7 @@ class RedisCache extends Cache implements IMemoryCache
public function delete($key) public function delete($key)
{ {
$cachekey = $this->getCacheKey($key); $cachekey = $this->getCacheKey($key);
return ($this->redis->delete($cachekey) > 0); return ($this->redis->del($cachekey) > 0);
} }
/** /**