init() public method

Initializes the Mutex component.
public init ( )
コード例 #1
0
 /**
  * Initializes MySQL specific mutex component implementation.
  * @throws InvalidConfigException if [[db]] is not MySQL connection.
  */
 public function init()
 {
     parent::init();
     if ($this->db->driverName !== 'mysql') {
         throw new InvalidConfigException('In order to use MysqlMutex connection must be configured to use MySQL database.');
     }
 }
コード例 #2
0
 /**
  * Initializes generic database table based mutex implementation.
  * @throws InvalidConfigException if [[db]] is invalid.
  */
 public function init()
 {
     parent::init();
     if (is_string($this->db)) {
         $this->db = Yii::$app->getComponent($this->db);
     }
     if (!$this->db instanceof Connection) {
         throw new InvalidConfigException('Mutex::db must be either a DB connection instance or the application component ID of a DB connection.');
     }
 }
コード例 #3
0
ファイル: DbMutex.php プロジェクト: lianghongle/yii2-zh-cn
 /**
  * Initializes generic database table based mutex implementation.
  * @throws InvalidConfigException if [[db]] is invalid.
  */
 public function init()
 {
     parent::init();
     $this->db = Instance::ensure($this->db, Connection::className());
 }
コード例 #4
0
ファイル: Mutex.php プロジェクト: intersvyaz/yii2-cache-mutex
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->cache = is_string($this->cache) ? Yii::$app->get($this->cache, false) : $this->cache;
 }