Skip to content

Instantly share code, notes, and snippets.

@juban juban/app.php
Last active Jul 16, 2019

Embed
What would you like to do?
Redis configuration for Craft CMS
<?php
/**
* Yii Application Config
*
* Edit this file at your own risk!
*
* The array returned by this file will get merged with
* vendor/craftcms/cms/src/config/app/main.php and [web|console].php, when
* Craft's bootstrap script is defining the configuration for the entire
* application.
*
* You can define custom modules and system components, and even override the
* built-in system components.
*/
return [
'components' => [
'cache' => [
'class' => 'yii\redis\Cache',
'defaultDuration' => 86400,
'keyPrefix' => getenv('REDIS_KEYPREFIX').'_cache_',
'redis' => [
'hostname' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_PORT'),
'database' => 0,
'password' => getenv('REDIS_PASSWORD') // Optional
]
],
'session' => [
'class' => 'yii\redis\Session',
'as sessionBehavior' => [
'class' => 'craft\behaviors\SessionBehavior'
],
'keyPrefix' => getenv('REDIS_KEYPREFIX').'_session_',
'redis' => [
'hostname' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_PORT'),
'database' => 1,
'password' => getenv('REDIS_PASSWORD') // Optional
]
],
],
'modules' => [
'siteModule' => \modules\Module::class,
],
'bootstrap' => [
'siteModule',
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.