Mautic Cache Redis config

Your software
My Mautic version is: 3.3
My PHP version is: 7.3
My Database type and version is: MySql 5.7

Your problem
My problem is: redis configuration.
Trying to configure redis as per documentation

These errors are showing in the log:
php bin/console cache:clear -vvv

// Clearing the cache for the prod environment with debug false


In CacheClearSubscriber.php line 55:

 [Exception]
 Failed to clear RedisTagAwareAdapter

Exception trace:
 at /var/www/html/app/bundles/CacheBundle/EventListener/CacheClearSubscriber.php:55
Mautic\CacheBundle\EventListener\CacheClearSubscriber->clear() at /var/www/html/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php:41
Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer->clear() at /var/www/html/vendor/symfony/framework-bundle/Command/CacheClearCommand.php:111
Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:86
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:74
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/www/html/bin/console:43

Steps I have tried to fix the problem:

I’ve tried various connection strings and looked through the symfony docs for dsn settings
redis://[user:pass@][ip|host|socket[:port]][/db-index]

Hello,

I am also trying to setup mautic to use Redis so I figured I would use an old post since there is no solution reply.

Your software
My Mautic version is: 4.1.1
My PHP version is: 7.4
My Database type and version is: MariaDB 10.3

Your problem
My problem is:
I am trying to configure Mautic so that it uses Redis instead of filesystem cache. I installed redis-server package on my system as well as php-redis.

These errors are showing in the log:
[no errors detect in logs]

Steps I have tried to fix the problem:

I have tried to looking into documentation here: https://developer.mautic.org/?php&_ga=2.63514735.1361225527.1642110543-284173810.1641816063#configuration and I tried to reverse engineer whats happening (I looked into cache bundle). I also consult Symfony docs to see how to configure a dsn.

I came up with the following configuration I put into app/config/local.php:

'cache_adapter' => 'mautic.cache.adapter.redis',
'cache_adapter_redis'     => array(
        'dsn'     => 'redis://<ip>:<port>/<database-index>',
        'options' => array(
                'lazy'           => false,
                'persistent'     => 0,
                'persistent_id'  => null,
                'timeout'        => 30,
                'read_timeout'   => 0,
                'retry_interval' => 0,
        ),
),
'cache_prefix' => 'pa_',
'cache_lifetime' => 3600

But it does not seem to have any effect. When I am using Mautic and regulary inspecting the contents of redis database there is no entries, meanwhile I can see that cache is being generated on the filesystem. What am I doing wrong?

Any help would be much appreciated.

Regards, M.

2 Likes

This should fixed it Add RedisAdapter from Symfony4 for CacheBundle by kuzmany · Pull Request #10889 · mautic/mautic · GitHub

3 Likes

Hei, i have applied the fix on #10889 and stil lsame problem.
Does anyone have applied succesfully this config redis with mautic and can share the steps and example of the actually working config ?

I would be very interested in seeing a tutorial or being pointed in the right direction to setup Redis to replace the current cache.

Anyone have some experience here ?

I have the same problem here. :slight_smile:

Hi guys, do you have any log? any exception/warning thrown?

@galvani not on my side. There’s just nothing happening.

Perhaps there is some misconception. The CacheBundle provides stuff to developers, it’s general interface to caching (multiple adapters). it will not affect where mautic caches its common files, like templates and compiled container and so on.
the /var/cache will still be used for most cases.

If caching is configured within plugins to use this bundle than the adapter selection will make difference.

this bundle just provides caching to others. it’s upon plugin’s developers whether they implement it.