We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problem of Phalcon incubator's Redis backend cache

My project with Phalcon incubator's Redis backend cache. But it has some problem. When I use native PHP's Redis class ,it works properly and it shows "Cannot connect to Redisd server" when use Redis backend cache:

    // Cache data for one day by default
    $frontCache = new Phalcon\Cache\Frontend\Data(array(
        'lifetime' => 86400 * 24
    ));

    // If the has redis enabled, use redis for cache
    if ($config->redis->enable) {
        $redis = new Redis();
        $redis->connect($config->redis->host, $config->redis->port);

        // It is work properly here
        $redis->set('love', 'foo');
        die();

        // But when I use Phalcon Incubator's Redis cache backend
        // It says "Cannot connect to Redisd server"
        $backRedis = new \Phalcon\Cache\Backend\Redis($frontCache, array(
            'redis' => $redis,
            'prefix' => 'wwp-cache-'
        ));

        $backRedis->save('love', 'foo');
        echo $backRedis->get('love');
        die();
    }

Does anybody know why?

I'm working on Phalcon 2.0



43.9k
Accepted
answer

Hi,

with 2.0 you do not need incubators library for the Redis cache backend as it is now in phalcon itself: https://docs.phalcon.io/en/latest/api/Phalcon_Cache_Backend_Redis.html



3.9k

But when I remove incubator from composer , where is my Phalcon\Mailer\Manager ... Phalcon 2.0 has no Phalcon\Mailer\Manager

Hi,

with 2.0 you do not need incubators library for the Redis cache backend as it is now in phalcon itself: https://docs.phalcon.io/en/latest/api/Phalcon_Cache_Backend_Redis.html



3.9k

I know now , phalcon 2.0 needs incubator 2.0.x branch

Hi,

with 2.0 you do not need incubators library for the Redis cache backend as it is now in phalcon itself: https://docs.phalcon.io/en/latest/api/Phalcon_Cache_Backend_Redis.html