/**
  * Initializes the application component.
  */
 public function init()
 {
     parent::init();
     if (!$this->cache instanceof HSCache) {
         throw new InvalidConfigException('Cache component for session must be instance of ' . HSCache::className());
     }
     $this->cache = clone $this->cache;
     $this->cache->group = $this->group;
 }
 /**
  * Initializes the HSCache component.
  * This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
  * @throws InvalidConfigException if [[db]] is invalid.
  */
 public function init()
 {
     parent::init();
     switch ($this->mode) {
         case 'multiType':
             $this->hs = new \HSLib\CacheMultiType($this->host . ':' . $this->portRead, $this->secret, $this->host . ':' . $this->portWrite, $this->secret, $this->db, $this->table, $this->debug);
             break;
         case 'multiTable':
             $this->hs = new \HSLib\CacheMultiTable($this->host . ':' . $this->portRead, $this->secret, $this->host . ':' . $this->portWrite, $this->secret, $this->db, $this->debug);
             break;
         default:
             throw new InvalidConfigException('Wrong mode in ' . HSCache::className());
     }
 }