Repository navigation
Replies: 1 comment
|
Needed this too, so I put it in a small package until (if) it lands in core: mohannadelemary/laravel-redis-connection-clients composer require mohannadelemary/laravel-redis-connection-clientsAdd a 'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'default' => [/* phpredis */],
'queue' => [
'client' => 'predis', // or a custom client registered with Redis::extend(), e.g. a Sentinel-aware one
// ...
],
],Laravel 12/13, PHP 8.3+. Feedback welcome. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently, Laravel’s
database.redis.clientsetting applies globally. This means that all Redis connections defined under thedatabase.redisconfiguration key must use the same client (e.g.,predis,phpredis, etc.).Problem
In projects where multiple Redis servers serve different roles, this limitation creates challenges. For example, in our case:
With the current implementation of
\Illuminate\Redis\RedisManager, it’s not possible to assign different clients (drivers) to different connections. This prevents us from configuring one Redis connection with a lightweight client for stateless operations, while another uses a Sentinel-aware client for queues.Proposal
Introduce the ability to optionally set the Redis client per connection.
database.redis.clientsetting as the default.database.redis.This would provide developers with flexibility to tailor Redis connections based on their role, availability requirements, and client capabilities, without breaking backward compatibility.
Benefits
database.redis.clientremains as the fallback.All reactions