Redis support for Concrete5?
Permalink 1 user found helpful
Hi there, I'm trying to enable Redis on my website, my webhosting is supporting it but I can't figure out how to enable it for my Concrete5 installation. Anyone has it working and is willing to share how to do it?
This is the sample override of Redis cache config for concrete5. This version only works and tested with PHP version 7.2 and 7.3.
Thank you very much for the reply! I'm not that confident with the config file tho, could you show me an example how to enable Redis inside the config file?
Where do I set the preferred driver to Redis? My concrete.php looks like this now:
It's showing a error message (see attachment).
<?php /** * ----------------------------------------------------------------------------- * Generated 2020-12-14T18:30:43+01:00 * * DO NOT EDIT THIS FILE DIRECTLY * * @item cache.clear.thumbnails * @group concrete * @namespace null * ----------------------------------------------------------------------------- */ return [ 'locale' => 'nl_NL', 'version_installed' => '8.5.4',
Viewing 15 lines of 43 lines. View entire code block.
It's showing a error message (see attachment).
Do you mind if I suggest to add these classes to the concrete5 core ... Stash already supports redis, but we are missing session and page cachehttp://www.alaskasworld.me/
The place to make such a request is on GitHub - feel free to open an issue.
Can anyone help me to setup the configuration? I can't get it to work on my own :(.
I figured it out!
Because we use a UNIX socket instead of TCP/IP, we need to do the following:
* Specify the server using the path to the socket. In my case, this was "/tmp/redis.sock"
* Specify the port as "0" (choose any other, or leave it out and your website stops functioning.)
Because it was quite the mission to find the correct configuration lines for the different caching that's possible in Concrete5 I will share the contents of my concrete.php below.
Please note that this file should be placed in the ./application/config folder, Leave concrete.php located in ./concrete/config or any other folder alone. (if ./application/config does not have a concrete.php file, just create it)
Note that I have used a different Redis database number for each cache as this was recommended. change the number as required if you are already using the ones in my config for another website.
The config takes care of using Redis for Overrides cache, Expensive cache, Full page caching, and Session handling. Object caching is also possible but when I tried it, it had a negative impact on the performance of my website.
I hope this helps everyone!
Best regards,
Jesse
ps: I have also included the contents of the above code box as an attachment.
Because we use a UNIX socket instead of TCP/IP, we need to do the following:
* Specify the server using the path to the socket. In my case, this was "/tmp/redis.sock"
* Specify the port as "0" (choose any other, or leave it out and your website stops functioning.)
Because it was quite the mission to find the correct configuration lines for the different caching that's possible in Concrete5 I will share the contents of my concrete.php below.
Please note that this file should be placed in the ./application/config folder, Leave concrete.php located in ./concrete/config or any other folder alone. (if ./application/config does not have a concrete.php file, just create it)
<?php return [ 'cache' => [ 'levels' => [ 'overrides' => [ 'preferred_driver' => 'redis', 'drivers'=> [ 'redis'=>[ 'options' => [ 'servers' => [ [ 'server' => '/tmp/redis.sock', 'port' => 0, //0 when connecting to a UNIX socket ], ],
Viewing 15 lines of 67 lines. View entire code block.
Note that I have used a different Redis database number for each cache as this was recommended. change the number as required if you are already using the ones in my config for another website.
The config takes care of using Redis for Overrides cache, Expensive cache, Full page caching, and Session handling. Object caching is also possible but when I tried it, it had a negative impact on the performance of my website.
I hope this helps everyone!
Best regards,
Jesse
ps: I have also included the contents of the above code box as an attachment.
https://github.com/concrete5/concrete5/pull/7206#issuecomment-546684...
You just need to configure your concrete.php config file with your redis credentials and change the preffered driver to 'redis'.