Answer the question
In order to leave comments, you need to log in
How to work with cache fragments in Yii2?
Faced a strange problem. I am using fragment cache in Yii2.
Everything looks simple
if ($this->beginCache($key, ['dependency' => $dependency])) {...тут некоторые действия...}
$dependency = [
'class' => 'yii\caching\DbDependency',
'sql' => 'SELECT updated FROM table WHERE id='.$model->id,
];
"frag-".$model->id
"frag"
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