Answer the question
In order to leave comments, you need to log in
How to pass parameter to cached request callback in Yii2?
Hello. I want to cache a request with a parameter ($ id), I
use the following construction
return self::getDb()->cache(function ($db) {
$this->getSomeTable()
->filterWhere(['some_field' => $id])
->count();
}, $cacheTimeout);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question