Example #1
0
 /**
  * @return \Predis\Client|\PredisPhpdoc\Client
  */
 public static function getConnection()
 {
     if (is_null(self::$predis)) {
         $host = __Config::get('glizy.database.caching.redis');
         self::$predis = new Predis\Client($host ? $host : 'tcp://127.0.0.1:6379');
     }
     return self::$predis;
 }
Example #2
0
 /**
  * @param      $model
  * @param      $lifeTime
  * @param null $cacheFolder
  */
 function __construct($model, $lifeTime = -1, $cacheFolder = null)
 {
     $this->model = $model;
     $this->lifeTime = $lifeTime;
     $this->redis = org_glizy_redis_Client::getConnection();
 }
Example #3
0
 public function __construct($lifetime, $prefix)
 {
     $this->redis = org_glizy_redis_Client::getConnection();
     $this->lifetime = (int) $lifetime;
     $this->prefix = $prefix . ':';
 }