/** * Initializes the redis Counter component. * This method will initialize the [[redis]] property to make sure it refers to a valid redis connection. * @throws InvalidConfigException if [[redis]] is invalid. */ public function init() { parent::init(); if (is_string($this->redis)) { $this->redis = Yii::$app->get($this->redis); } elseif (is_array($this->redis)) { if (!isset($this->redis['class'])) { $this->redis['class'] = Connection::className(); } $this->redis = Yii::createObject($this->redis); } if (!$this->redis instanceof Connection) { throw new InvalidConfigException("Counter::redis must be either a Redis connection instance or the application component ID of a Redis connection."); } }
/** * Initializes the redis Session component. * This method will initialize the [[redis]] property to make sure it refers to a valid redis connection. * @throws InvalidConfigException if [[redis]] is invalid. */ public function init() { if (is_string($this->redis)) { $this->redis = Yii::$app->get($this->redis); } elseif (is_array($this->redis)) { if (!isset($this->redis['class'])) { $this->redis['class'] = Connection::className(); } $this->redis = Yii::createObject($this->redis); } if (!$this->redis instanceof Connection) { throw new InvalidConfigException("Session::redis must be either a Redis connection instance or the application component ID of a Redis connection."); } if ($this->keyPrefix === null) { $this->keyPrefix = substr(md5(Yii::$app->id), 0, 5); } parent::init(); }
/** * @return void */ public function init() { parent::init(); $this->db = \yii\di\Instance::ensure($this->db, Connection::className()); }
/** * Initializes the redis Cache component. * This method will initialize the [[redis]] property to make sure it refers to a valid redis connection. * @throws InvalidConfigException if [[redis]] is invalid. */ public function init() { parent::init(); $this->redis = Instance::ensure($this->redis, Connection::className()); }
<?php return ['name' => 'setYes', 'language' => 'ru', 'charset' => 'UTF-8', 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'components' => ['userAgentParser' => ['class' => \yii\useragentparser\UserAgentParser::className(), 'nameHttpPropertyUserAgent' => 'HTTP_USER_AGENT'], 'googleApi' => ['class' => \common\widgets\GoogleMapsMarkers\GoogleMaps::className(), 'geocode_api_key' => 'AIzaSyBn0XnEmdPDw9ku7H66JT4_9KN7IXDZfcA', 'webroot' => '@webroot', 'map_language' => 'en'], 'reCaptcha' => ['name' => 'reCaptcha', 'class' => 'himiklab\\yii2\\recaptcha\\ReCaptcha', 'siteKey' => '6LcWAxMTAAAAAD2teUNSJdJ8OwfQuqIUyJJDW79j', 'secret' => '6LcWAxMTAAAAAEZCbXGi-azhHhA8kYRq5WmY9pLg'], 'redis' => ['class' => \yii\redis\Connection::className(), 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, 'dataTimeout' => 30], 'cache' => ['class' => 'yii\\redis\\Cache', 'redis' => ['hostname' => 'localhost', 'port' => 6379, 'database' => 1]], 'session' => ['class' => 'yii\\redis\\Session', 'redis' => ['hostname' => 'localhost', 'port' => 6379, 'database' => 2]], 'authManager' => ['class' => 'yii\\rbac\\DbManager'], 'authClientCollection' => require __DIR__ . '/auth.php', 'assetManager' => ['class' => 'yii\\web\\AssetManager'], 'formatter' => ['defaultTimeZone' => 'UTC', 'datetimeFormat' => 'php:d.mm.Y H:s', 'decimalSeparator' => ',', 'thousandSeparator' => ' ', 'currencyCode' => 'RUB'], 'i18n' => ['class' => common\widgets\yii2TranslatePanel\components\I18N::className(), 'languages' => ['ru', 'de', 'fr'], 'format' => 'db', 'sourcePath' => [__DIR__ . '/../../frontend', __DIR__ . '/../../backend', __DIR__ . '/../../common', __DIR__ . '/../../console'], 'messagePath' => __DIR__ . '/../../messages', 'translations' => ['*' => ['class' => yii\i18n\DbMessageSource::className(), 'enableCaching' => true, 'cachingDuration' => 60 * 60 * 2], 'yii' => ['class' => yii\i18n\DbMessageSource::className(), 'enableCaching' => true, 'cachingDuration' => 60 * 60 * 2], 'app' => ['class' => yii\i18n\DbMessageSource::className(), 'enableCaching' => true, 'cachingDuration' => 60 * 60 * 2]]]]];