Answer the question
In order to leave comments, you need to log in
How to cache fragments in a widget in Yii2?
in the widget I write like this:
if ($this->beginCache('top-search-block' . '-' . md5(implode('|', $filter['filter'])), ['duration' => 15 * 60 ])) {
.....
$this->endCache();
}
Answer the question
In order to leave comments, you need to log in
The error clearly states.
I translate: The called beginCache() method is missing in frontend\widgets\Search\SearchWidget
You have an instance of the frontend\widgets\Search\SearchWidget class in $this
And beginCache() is a method that should apparently be called here Yii::$app->cache
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question