How to integrate Redis into Craft 3
Knowledgebase Article
}
Knowledgebase Article
The following article assumes you've installed CraftCMS version 3 on your account.
To use Redis, you must be on a plan that supports it. Redis is available on all Business Hosting plans. If you need assistance with checking if Redis is available on your account, or you wish to upgrade your existing plan to a Business Plan, please open a support ticket on our HelpDesk.
Make sure you have enabled Redis in cPanel. If you're not sure how to do this, please see the following KB Article
Installing Redis requires SSH access. If you need SSH access enabled please contact us on our HelpDesk
1.) SSH into your account.
2.) Navigate to your craft installation folder.
3.) Run the following command:
composer require --prefer-dist yiisoft/yii2-redis
4.) Once installed, you'll need to edit the config/app.php file to include the following code, be sure to add this below the "return [" line:
'components' => [
'cache' => [
'class' => yii\redis\Cache::class,
'defaultDuration' => 86400,
'redis' => [
'unixSocket' => '/home/USER/.kxcache/redis.sock',
'database' => 0,
],
],
],
5.) When adding the code, make sure to edit the 'USER' with your cPanel user. Also, make sure to specify a unique database number (0, 1, 2, etc) if you have multiple instances of redis.
If you have any issues or questions, please open a Support Ticket within our HelpDesk
Powered by WHMCompleteSolution