yii\mutex\Mutex::init PHP Метод

init() публичный Метод

Initializes the Mutex component.
public init ( )
    public function init()
    {
        if ($this->autoRelease) {
            $locks =& $this->_locks;
            register_shutdown_function(function () use(&$locks) {
                foreach ($locks as $lock) {
                    $this->release($lock);
                }
            });
        }
    }

Usage Example

 /**
  * 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.');
     }
 }
All Usage Examples Of yii\mutex\Mutex::init