PHP Класс CacheBehavior

Наследование: extends CActiveRecordBehavior
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cacheResults boolean Whether or not to cache this call's results
$settings array Settings

Открытые методы

Метод Описание
beforeDelete ( Model $Model, $cascade = true ) Intercepts delete to use the caching datasource instead
beforeFind ( Model $Model, array $queryData ) Intercepts find to use the caching datasource instead
beforeSave ( Model $Model, $options = [] ) Intercepts save to use the caching datasource instead
clearCache ( Model $Model, $queryData = null ) : boolean Clears all of the cache for this model's find queries. Optionally, pass $queryData to just clear a specific query
setup ( Model $Model, array $config = [] ) Sets up a connection using passed settings

Защищенные методы

Метод Описание
_prepareFind ( Model $Model, $query = [] ) * Prepares a query by adding missing data. This function is needed because reads on the database typically bypass Model::find() which is where the query is changed.

Описание методов

_prepareFind() защищенный Метод

* Prepares a query by adding missing data. This function is needed because reads on the database typically bypass Model::find() which is where the query is changed.
См. также: Model::find()
protected _prepareFind ( Model $Model, $query = [] )
$Model Model
$query The query

beforeDelete() публичный Метод

Intercepts delete to use the caching datasource instead
public beforeDelete ( Model $Model, $cascade = true )
$Model Model The calling model

beforeFind() публичный Метод

If $queryData['cacher'] is true, it will cache based on the setup settings If $queryData['cacher'] is a duration, it will cache using the setup settings and the new duration.
public beforeFind ( Model $Model, array $queryData )
$Model Model The calling model
$queryData array The query

beforeSave() публичный Метод

Intercepts save to use the caching datasource instead
public beforeSave ( Model $Model, $options = [] )
$Model Model The calling model

clearCache() публичный Метод

Clears all of the cache for this model's find queries. Optionally, pass $queryData to just clear a specific query
public clearCache ( Model $Model, $queryData = null ) : boolean
$Model Model The calling model
Результат boolean

setup() публичный Метод

### Config - config The name of an existing Cache configuration to use. Default is 'default' - clearOnSave Whether or not to delete the cache on saves - clearOnDelete Whether or not to delete the cache on deletes - auto Automatically cache or look for 'cache' in the find conditions where the key is true or a duration
См. также: Cache::config()
public setup ( Model $Model, array $config = [] )
$Model Model The calling model
$config array Configuration settings

Описание свойств

$cacheResults публичное свойство

Whether or not to cache this call's results
public bool $cacheResults
Результат boolean

$settings публичное свойство

Settings
public array $settings
Результат array