Hi guys,
I would like to cache my dynamic pages from the database, from one method.
For example
- www.domain.tld/cars/red
- www.domain.tld/cars/blue
- www.domain.tld/cars/green
URL-Structure
www.domain.tld/cars/KEYWORD
My code doesn’t work, because if I call red-cars, only this page is cached for 60 sec.
But my goal is, to cache every dynamic page.
What I’m doing wrong?
public function behaviors()
{
return [
'pageCache' => [
'class' => 'yii\filters\PageCache',
'only' => ['view'],
'duration' => 10,
'dependency' =>
[
'class' => 'yii\caching\DbDependency',
'sql' => 'SELECT COUNT(*) FROM dict_phrases',
],
'variations' =>
[
\Yii::$app->language,
]
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}