File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public function __construct(array $config)
26
26
'reserved ' => null ,
27
27
'retry_interval ' => null ,
28
28
'persisted ' => false ,
29
+ 'database ' => 0 ,
29
30
], $ config );
30
31
}
31
32
@@ -80,6 +81,8 @@ public function connect()
80
81
$ this ->config ['retry_interval ' ]
81
82
);
82
83
}
84
+
85
+ $ this ->redis ->select ($ this ->config ['database ' ]);
83
86
}
84
87
85
88
return $ this ->redis ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class RedisConnectionFactory implements PsrConnectionFactory
27
27
* 'vendor' => 'The library used internally to interact with Redis server
28
28
* 'persisted' => bool, Whether it use single persisted connection or open a new one for every context
29
29
* 'lazy' => the connection will be performed as later as possible, if the option set to true
30
+ * 'database' => Database index to select when connected (default value: 0)
30
31
* ].
31
32
*
32
33
* or
@@ -139,6 +140,7 @@ private function defaultConfig()
139
140
'vendor ' => 'phpredis ' ,
140
141
'persisted ' => false ,
141
142
'lazy ' => true ,
143
+ 'database ' => 0 ,
142
144
];
143
145
}
144
146
}
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ public function addConfiguration(ArrayNodeDefinition $builder)
54
54
->defaultTrue ()
55
55
->info ('the connection will be performed as later as possible, if the option set to true ' )
56
56
->end ()
57
+ ->integerNode ('database ' )
58
+ ->defaultValue (0 )
59
+ ->info ('Database index to select when connected. ' )
60
+ ->end ()
57
61
;
58
62
}
59
63
You can’t perform that action at this time.
0 commit comments