0

I am having a super hard time getting redis to be configured. It was working, but I upgraded my servers and composer updated- now I getting "redis is not configured correctly"

     define('_CACHE_SERVER', '*********.cache.amazonaws.com:6379');


     '_cake_core_' => [
        'className' => 'Redis',
        'servers'=> [ _CACHE_SERVER ],
        'prefix' => 'mrg_cake_core_',
        'serialize' => 'php',
        'duration' => '+2 minutes',
    ],

I have written a blank php and connected to redis with just simple $redis = new Redis(); and got $redis->lastSave(); Seems like something changed in CAKE. Very confused.

mconnors
  • 155
  • 2
  • 13
  • Is that your actual code, or just an example? Because [**there is no `servers` option](https://book.cakephp.org/3/en/core-libraries/caching.html#redisengine-options)**, there's one called `server` without the trailing `s`, however that name is somewhat discouraged, and you should use `host` instead! The option named `servers` is used by the Memcache engine, just like the `serialize` option. – ndm Apr 17 '20 at 07:39
  • ps. whenever you receive an error, please post the _complete_ error message, and include the related stacktrace (you'll find both in your CakePHP `/logs/`)! Also please always mention your exact CakePHP version (last line in `lib/Cake/VERSION.txt` or `vendor/cakephp/cakephp/VERSION.txt`) - thanks! – ndm Apr 17 '20 at 07:39
  • Thank you ndm, I swear I had tried the config from the docs and it still didn't work. And I am pretty sure this older config had been working for a super long time. I setup a new server and tried the new config again, removed php serialize and it worked. I really appreciate the help. – mconnors Apr 17 '20 at 14:59

1 Answers1

0

Thank you ndm, I changed the config to:

    define('_CACHE_SERVER', '************.cache.amazonaws.com');

    '_cake_core_' => [
        'className' => 'Redis',
        'host' => _CACHE_SERVER,
        'port' => 6379,
        'prefix' => 'myapp_cake_core_',
        'duration' => '+1 years',
        'url' => env('CACHE_CAKECORE_URL', null),
    ],
mconnors
  • 155
  • 2
  • 13