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.

Class 'redis' not found

Use phalcon 3.1.1, php7.0.11, Redis 3.2.100

I have redis registered like so

use Phalcon\Cache\Backend\Redis;
use Phalcon\Cache\Frontend\Igbinary as FrontData;

$di->setShared('cache', function (){
    $frontCache = new FrontData(['lifetime' => 120]);
    $cache = new Redis($frontCache,[
        "host"       => '127.0.0.1',
        "port"       => 6379,
        "auth"       => '',
        "persistent" => false,
        "index"      => 0,
    ]);
    return $cache;
});

Using it like so:

        $copList = $this->cache->get('player_cop_list');

        if($copList === null)
        {
            $copList = Players::find("coplevel > '0'");
            $this->cache->save('player_cop_list', $copList, 900);
        }

but I get the error PHP Fatal error: Class 'redis' not found when running the code.



1.3k
Accepted
answer

Solved it by installing the php_redis extension https://pecl.php.net/package/redis