bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

Redis setting database number and password #1229

Closed brandshopru closed 3 years ago

brandshopru commented 3 years ago

Hello! Tell me how to use a socket to connect to a Redis, select a database other than 0 and set a password?

I didn't find anything useful in core code if (preg_match('/^redis=(.+)/',$dsn,$parts) && extension_loaded('redis')) { list($host,$port,$db,$password)=explode(':',$parts[1])+[1=>6379,2=>NULL,3=>NULL]; $this->ref=new Redis; if(!$this->ref->connect($host,$port,2)) $this->ref=NULL; if(!empty($password)) $this->ref->auth($password); if(isset($db)) $this->ref->select($db); }

brandshopru commented 3 years ago

The question is closed.

xfra35 commented 3 years ago

It should be:

$f3->set('CACHE','redis=host:port:db:password');