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

File,Memcached,APC,Mongo,XCache,No Redis~

why no redis?



51.2k

There is no built-in support, but you can find it in incubator. Clone it and you can use it.

https://github.com/phalcon/incubator

Example:

            $di->set('cache', function() {

                //Connect to redis
                $redis = new \Redis();
                $redis->connect('127.0.0.1', 6379);

                //Create a Data frontend and set a default lifetime to 1 hour
                $frontend = new Phalcon\Cache\Frontend\Igbinary(array(
                        'lifetime' => 3600
                ));

                //Create the cache passing the connection
                $cache = new Phalcon\Cache\Backend\Redis($frontend, array(
                        'redis' => $redis
                ));

                return $cache;
            });


1.1k