File tree Expand file tree Collapse file tree 2 files changed +9
-33
lines changed Expand file tree Collapse file tree 2 files changed +9
-33
lines changed Original file line number Diff line number Diff line change 18
18
use phpFastCache \Exceptions \phpFastCacheDriverException ;
19
19
use phpFastCache \Util \Directory ;
20
20
21
+ /**
22
+ * Trait PathSeekerTrait
23
+ * @package phpFastCache\Core\Pool\IO
24
+ * @property array $config The configuration array passed via DriverBaseTrait
25
+ */
21
26
trait PathSeekerTrait
22
27
{
23
28
/**
Original file line number Diff line number Diff line change @@ -124,43 +124,14 @@ protected function driverClear()
124
124
*/
125
125
protected function driverConnect ()
126
126
{
127
- $ server = isset ($ this ->config [ 'redis ' ]) ? $ this ->config [ 'redis ' ] : [
127
+ $ config = isset ($ this ->config [ 'redis ' ]) ? $ this ->config [ 'redis ' ] : [];
128
+
129
+ $ this ->instance = new PredisClient (array_merge ([
128
130
'host ' => '127.0.0.1 ' ,
129
131
'port ' => '6379 ' ,
130
132
'password ' => '' ,
131
133
'database ' => '' ,
132
- ];
133
-
134
- $ config = [
135
- 'host ' => $ server [ 'host ' ],
136
- ];
137
-
138
- $ port = isset ($ server [ 'port ' ]) ? $ server [ 'port ' ] : '' ;
139
- if ($ port != '' ) {
140
- $ config [ 'port ' ] = $ port ;
141
- }
142
-
143
- $ password = isset ($ server [ 'password ' ]) ? $ server [ 'password ' ] : '' ;
144
- if ($ password != '' ) {
145
- $ config [ 'password ' ] = $ password ;
146
- }
147
-
148
- $ database = isset ($ server [ 'database ' ]) ? $ server [ 'database ' ] : '' ;
149
- if ($ database != '' ) {
150
- $ config [ 'database ' ] = $ database ;
151
- }
152
-
153
- $ timeout = isset ($ server [ 'timeout ' ]) ? $ server [ 'timeout ' ] : '' ;
154
- if ($ timeout != '' ) {
155
- $ config [ 'timeout ' ] = $ timeout ;
156
- }
157
-
158
- $ read_write_timeout = isset ($ server [ 'read_write_timeout ' ]) ? $ server [ 'read_write_timeout ' ] : '' ;
159
- if ($ read_write_timeout != '' ) {
160
- $ config [ 'read_write_timeout ' ] = $ read_write_timeout ;
161
- }
162
-
163
- $ this ->instance = new PredisClient ($ config );
134
+ ], $ config ));
164
135
165
136
return true ;
166
137
}
You can’t perform that action at this time.
0 commit comments