Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/apolloeleven/yii2-behaviors

This repository contains helper global behaviors for Yii2 Framework
https://github.com/apolloeleven/yii2-behaviors

Last synced: 3 days ago
JSON representation

This repository contains helper global behaviors for Yii2 Framework

Awesome Lists containing this project

README

        

# Yii2 behaviors

#### Global Page Cache Behavior

Following behavior gives you the ability to enable Yii2 PageCache globally
from config. Copy the following config to your respective config file.
```php
...
'as globalCache' => [
'class' => '\apollo11\behaviors\behaviors\GlobalPageCacheBehavior',
'rules' => [
[
'controller' => 'about',
'actions' => ['index', 'main'],
'except' => ['view'],
'duration' => 70,
'variations' => [
\apollo11\behaviors\behaviors\GlobalPageCacheBehavior::VARIATION_BY_LANGUAGE,
\apollo11\behaviors\behaviors\GlobalPageCacheBehavior::VARIATION_BY_URL,
],
]
]
],
...
```

Param
Value

Controller
String : Controller ID : Required

Duration
Integer : Cache duration in seconds : Optional : Default - 60 seconds

Actions
Array : Action IDs to cache: Required : '*' - for all actions

Except
Array : Action IDs to skip cache on : Optional

Variations
Array : Strings for respective vartiations of caching : Optional