File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class Config extends ConfigurationOption
2828 /**
2929 * @var int
3030 */
31- protected $ port;
31+ protected $ port = 8091 ; // SSL: 18091
3232
3333 /**
3434 * @var string
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ class Config extends ConfigurationOption
5050 */
5151 protected $ optPrefix = '' ;
5252
53+ /**
54+ * @var int
55+ */
56+ protected $ timeout = 5 ;
57+
5358 /**
5459 * @return string
5560 */
@@ -132,6 +137,7 @@ public function getPredisConfigArray(): array
132137 'port ' => $ this ->getPort (),
133138 'password ' => $ this ->getPassword () ?: null ,
134139 'database ' => $ this ->getDatabase (),
140+ 'timeout ' => $ this ->getTimeout (),
135141 ];
136142 }
137143
@@ -172,4 +178,22 @@ public function setOptPrefix(string $optPrefix): Config
172178 $ this ->optPrefix = trim ($ optPrefix );
173179 return $ this ;
174180 }
181+
182+ /**
183+ * @return int
184+ */
185+ public function getTimeout (): int
186+ {
187+ return $ this ->timeout ;
188+ }
189+
190+ /**
191+ * @param int $timeout
192+ * @return self
193+ */
194+ public function setTimeout (int $ timeout ): self
195+ {
196+ $ this ->timeout = $ timeout ;
197+ return $ this ;
198+ }
175199}
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ protected function driverConnect(): bool
8282 if (!empty ($ this ->getConfig ()->getPath ())) {
8383 $ this ->instance = new PredisClient ([
8484 'scheme ' => 'unix ' ,
85+ 'timeout ' => $ this ->getConfig ()->getTimeout (),
8586 'path ' => $ this ->getConfig ()->getPath (),
8687 ], $ options );
8788 } else {
You can’t perform that action at this time.
0 commit comments