if ($this->beginCache('top-search-block' . '-' . md5(implode('|', $filter['filter'])), ['duration' => 15 * 60 ])) {
.....
$this->endCache();
}
Calling unknown method: frontend\widgets\Search\SearchWidget::beginCache()
$this->view->beginCache
$this->endCache();
тоже надо заменить $this->head()
$data = Yii::$app->cache->get('somekey');
if ($data === false) {
$data = SomeMyWidget::widget([
'someParam' => $someParam;
]);
$cache->set('somekey', $data, 3600);
}
echo $data;
$key = md5('company_id'.$company_id.'city_id'.$city->id);
$data = Yii::$app->cache->get($key);
if ($data === false) {
$data = product::find()->where(['<>', 'company_id', NULL])->andwhere(['city_id' => $city->id])->one()->company_id
$cache->set($key, $data, 3600);
}
$company_id = $data;