Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/apolloeleven/yii2-behaviors
- Owner: apolloeleven
- Created: 2019-04-25T10:44:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-25T12:35:10.000Z (over 5 years ago)
- Last Synced: 2024-12-17T01:56:22.443Z (21 days ago)
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
ValueController
String : Controller ID : RequiredDuration
Integer : Cache duration in seconds : Optional : Default - 60 secondsActions
Array : Action IDs to cache: Required : '*' - for all actionsExcept
Array : Action IDs to skip cache on : OptionalVariations
Array : Strings for respective vartiations of caching : Optional