@@ -74,9 +74,9 @@ protected function createClient(array $config)
74
74
return tap (new Redis , function ($ client ) use ($ config ) {
75
75
if ($ client instanceof RedisFacade) {
76
76
throw new LogicException (
77
- extension_loaded ('redis ' )
78
- ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension. '
79
- : 'Please make sure the PHP Redis extension is installed and enabled. '
77
+ extension_loaded ('redis ' )
78
+ ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension. '
79
+ : 'Please make sure the PHP Redis extension is installed and enabled. '
80
80
);
81
81
}
82
82
@@ -127,6 +127,10 @@ protected function establishConnection($client, array $config)
127
127
$ parameters [] = Arr::get ($ config , 'read_timeout ' , 0.0 );
128
128
}
129
129
130
+ if (version_compare (phpversion ('redis ' ), '5.3.0 ' , '>= ' )) {
131
+ $ parameters [] = Arr::get ($ config , 'context ' , []);
132
+ }
133
+
130
134
$ client ->{($ persistent ? 'pconnect ' : 'connect ' )}(...$ parameters );
131
135
}
132
136
@@ -151,6 +155,10 @@ protected function createRedisClusterInstance(array $servers, array $options)
151
155
$ parameters [] = $ options ['password ' ] ?? null ;
152
156
}
153
157
158
+ if (version_compare (phpversion ('redis ' ), '5.3.2 ' , '>= ' )) {
159
+ $ parameters [] = Arr::get ($ options , 'context ' , []);
160
+ }
161
+
154
162
return tap (new RedisCluster (...$ parameters ), function ($ client ) use ($ options ) {
155
163
if (! empty ($ options ['prefix ' ])) {
156
164
$ client ->setOption (RedisCluster::OPT_PREFIX , $ options ['prefix ' ]);
0 commit comments