public function init() { $cacheKey = [WidgetMenu::className(), $this->key]; $this->items = Yii::$app->cache->get($cacheKey); if ($this->items === false) { if (!($model = WidgetMenu::findOne(['key' => $this->key, 'status' => WidgetMenu::STATUS_ACTIVE]))) { throw new InvalidConfigException(); } $this->items = json_decode($model->items, true); Yii::$app->cache->set($cacheKey, $this->items, 60 * 60 * 24); } }