Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



29.1k
Accepted
answer

Hi,

with 2.0 you do not need incubators library for the Redis cache backend as it is now in phalcon itself: http://docs.phalconphp.com/en/latest/api/Phalcon%5Cache%5Backend%5Redis.html



2.0k

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: http://docs.phalconphp.com/en/latest/api/Phalcon%5Cache%5Backend%5Redis.html



2.0k

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: http://docs.phalconphp.com/en/latest/api/Phalcon%5Cache%5Backend%5Redis.html