/**
  * Gets the static model
  * @param string $className the model class to instantiate
  * @return ExampleRedisRecord the model
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Beispiel #2
0
 /**
  * Returns the redis connection used by redis record.
  * By default, the "redis" application component is used as the redis connection.
  * You may override this method if you want to use a different redis connection.
  * @return ARedisConnection the redis connection used by redis record.
  */
 public function getRedisConnection()
 {
     if ($this->_connection !== null) {
         return $this->_connection;
     } elseif (self::$redis !== null) {
         return self::$redis;
     } else {
         self::$redis = Yii::app()->redis;
         if (self::$redis instanceof ARedisConnection) {
             return self::$redis;
         } else {
             throw new CException(Yii::t('yii', 'Redis Record requires a "redis" ARedisConnection application component.'));
         }
     }
 }