コード例 #1
0
ファイル: Redis.php プロジェクト: rchicoli/owncloud-core
 public function __construct($prefix = '')
 {
     parent::__construct($prefix);
     if (is_null(self::$cache)) {
         self::$cache = \OC::$server->getGetRedisFactory()->getInstance();
     }
 }
コード例 #2
0
ファイル: redis.php プロジェクト: Kevin-ZK/vaneDisk
 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']);
         }
     }
 }