public function __construct($prefix = '') { parent::__construct($prefix); if (is_null(self::$cache)) { self::$cache = \OC::$server->getGetRedisFactory()->getInstance(); } }
public function __construct($prefix = '') { parent::__construct($prefix); if (is_null(self::$cache)) { // TODO allow configuring a RedisArray, see https://github.com/nicolasff/phpredis/blob/master/arrays.markdown#redis-arrays self::$cache = new \Redis(); $config = \OC::$server->getSystemConfig()->getValue('redis', array()); if (isset($config['host'])) { $host = $config['host']; } else { $host = '127.0.0.1'; } if (isset($config['port'])) { $port = $config['port']; } else { $port = 6379; } if (isset($config['timeout'])) { $timeout = $config['timeout']; } else { $timeout = 0.0; // unlimited } self::$cache->connect($host, $port, $timeout); if (isset($config['dbindex'])) { self::$cache->select($config['dbindex']); } } }