File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 4242 'heartbeat ' => -1 ,
4343 'max_idle_time ' => (float ) env ('REDIS_MAX_IDLE_TIME ' , 60 ),
4444 ],
45+ 'options ' => [
46+ 'prefix ' => env ('REDIS_PREFIX ' , '' ),
47+ ],
4548 ],
4649];
Original file line number Diff line number Diff line change @@ -120,7 +120,20 @@ public function reconnect(): bool
120120 $ options = $ this ->config ['options ' ] ?? [];
121121
122122 foreach ($ options as $ name => $ value ) {
123- // The name is int, value is string.
123+ if (is_string ($ name )) {
124+ $ name = match (strtolower ($ name )) {
125+ 'serializer ' => Redis::OPT_SERIALIZER , // 1
126+ 'prefix ' => Redis::OPT_PREFIX , // 2
127+ 'read_timeout ' => Redis::OPT_READ_TIMEOUT , // 3
128+ 'scan ' => Redis::OPT_SCAN , // 4
129+ 'failover ' => defined (Redis::class . '::OPT_SLAVE_FAILOVER ' ) ? Redis::OPT_SLAVE_FAILOVER : 5 , // 5
130+ 'keepalive ' => Redis::OPT_TCP_KEEPALIVE , // 6
131+ 'compression ' => Redis::OPT_COMPRESSION , // 7
132+ 'reply_literal ' => Redis::OPT_REPLY_LITERAL , // 8
133+ 'compression_level ' => Redis::OPT_COMPRESSION_LEVEL , // 9
134+ default => $ name ,
135+ };
136+ }
124137 $ redis ->setOption ($ name , $ value );
125138 }
126139
You can’t perform that action at this time.
0 commit comments