Skip to content

Commit

Permalink
Update redis.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hans2103 committed May 31, 2014
1 parent 021fec9 commit 86a86a1
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions libraries/joomla/cache/storage/redis.php
Expand Up @@ -75,9 +75,12 @@ protected function getConnection()
$server['auth'] = $config->get('redis_server_auth', NULL);

self::$_redis = new Redis();
if($this->_persistent){
if($this->_persistent)
{
$redistest = self::$_redis->pconnect($server['host'], $server['port']) && self::$_redis->auth($server['auth']);
}else{
}
else
{
$redistest = self::$_redis->connect($server['host'], $server['port']) && self::$_redis->auth($server['auth']);
}

Expand All @@ -88,6 +91,7 @@ protected function getConnection()
{
JError::raiseWarning(500, JText::_('JLIB_CACHE_ERROR_CACHE_STORAGE_REDIS_NO_CONNECTION'));
}

return;
}

Expand All @@ -109,6 +113,7 @@ public function get($id, $group, $checkTime = true)
{
$cache_id = $this->_getCacheId($id, $group);
$back = self::$_redis->get($cache_id);

return $back;
}

Expand All @@ -127,17 +132,21 @@ public function getAll()
$data = array();
$secret = $this->_hash;

if (!empty($allKeys)){
foreach ($allKeys as $key){
if (!empty($allKeys))
{
foreach ($allKeys as $key)
{
$namearr = explode('-', $key);

if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache'){
if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache')
{
$group = $namearr[2];

if (!isset($data[$group])){
$item = new JCacheStorageHelper($group);
}
else{
else
{
$item = $data[$group];
}
$item->updateSize(strlen($key)*8/1024);
Expand Down Expand Up @@ -170,7 +179,8 @@ public function store($id, $group, $data)

$config = JFactory::getConfig();
$lifetime = (int) $config->get('cachetime', 15);
if ($this->_lifetime == $lifetime){
if ($this->_lifetime == $lifetime)
{
$this->_lifetime = $lifetime * 60;
}

Expand Down Expand Up @@ -229,6 +239,7 @@ public function clean($group, $mode = null)
self::$_redis->delete($key);
}
}

return true;
}

Expand Down

0 comments on commit 86a86a1

Please sign in to comment.