File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ public function __construct(array $options = array())
4141 if (!isset (self ::$ defaultOptions ['password ' ])) {
4242 self ::$ defaultOptions ['password ' ] = null ;
4343 }
44+ if (!isset (self ::$ defaultOptions ['db ' ])) {
45+ self ::$ defaultOptions ['db ' ] = false ;
46+ }
4447
4548 $ this ->options = array_merge (self ::$ defaultOptions , $ options );
4649 $ this ->redis = new \Redis ();
@@ -97,6 +100,9 @@ private function openConnection()
97100 if ($ this ->options ['password ' ]) {
98101 $ this ->redis ->auth ($ this ->options ['password ' ]);
99102 }
103+ if ($ this ->options ['db ' ]){
104+ $ this ->redis ->select ($ this ->options ['db ' ]);
105+ }
100106 $ this ->redis ->setOption (\Redis::OPT_READ_TIMEOUT , $ this ->options ['read_timeout ' ]);
101107 } catch (\RedisException $ e ) {
102108 throw new StorageException ("Can't connect to Redis server " , 0 , $ e );
You can’t perform that action at this time.
0 commit comments