undefinedor/yii2-cached-active-record

The cached activeRecord for the Yii2 framework

0.0.3 2016-07-28 10:04 UTC

This package is not auto-updated.

Last update: 2024-04-22 11:58:17 UTC


README

Installation

The preferred way to install this extension is through Composer .

composer require undefinedor/yii2-cached-active-record

Configuration

In order to use CachedActiveRecord, a valid cache component must be enabled. For Example:

    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
    ],

Usage

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 
    }