-
-
Save tonyclemmey/37d9d1770fe8bae6267e3cb7dcf51006 to your computer and use it in GitHub Desktop.
Redis configuration for Craft CMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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