The preferred way to install this extension is through Composer .
composer require undefinedor/yii2-cached-active-record
In order to use CachedActiveRecord, a valid cache component must be enabled. For Example:
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
],
It's so easy to use ,you just need to use [[undefinedor\yii2\CachedActiveRecord]] For example,
<?php
namespace common\models;
use undefinedor\yii2\CachedActiveRecord;
use yii\db\ActiveRecord;
class BaseActiveRecord extends ActiveRecord
{
use CachedActiveRecord;
//todo
}