ReflectionException' with message 'Class yii\filters\PageCache does not exist'

I want to use pagecaching but I am getting this error:

I’ve checked the folder the file is there; So i don’t understand what is the problem exactly.

My configuration of the behavior is:




 public function behaviors()

    {

        return [

            'access' => [

                'class' => AccessControl::className(),

                'rules' => [

                    ['allow' => true, 'actions' => ['cipo','icons','interested','validate','timezone','index','help','captcha','fullimage','about','contact','follow','terms'], 'roles' => ['?','@']],

                    ['allow'=>true,'actions'=>['activeads'],'roles'=>['@']]

                ]

            ],

[

'class'=> 'yii\filters\PageCache',

'only'=> ['index'],

'duration'=> 60,

'variations'=> [

\Yii::$app->language,

],

'dependency'=> [

'class'=> 'yii\caching\DbDependency',

'sql'=> 'SELECT COUNT(*) FROM post',

],

],

          

        ];

    }

I need help how want to be caching my pages pleases!!!

I don’t know, but this looks like the right way (used inside function behaviors() )

http://www.yiiframework.com/doc-2.0/guide-caching-page.html#page-caching

You must set type of caching you are using in config
EG:
‘components’ => [
‘cache’ => [
‘class’ => ‘yii\caching\ApcCache’,
],
],

Detail : https://www.yiiframework.com/doc/guide/2.0/en/caching-data