Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[6.x] Set Redis cluster prefix with PhpRedis #30461
When using the PhpRedis extension, the prefix is only set when connecting to a single server. Since RedisCluster class allows to set a prefix, this PR modifies PhpRedisConnector class to set the prefix when creating a cluster instance.
This PR fixes #25619.
By the way, there are no tests that cover cluster connections. Would it be possible to modify the Travis pipeline in some way to run a cluster? Thus, it would be possible to run all Redis tests in both cases.
@taylorotwell Yes for the first answer, because it is the desired behaviour, and no for the second one.
On the one hand, there is the global prefix to avoid collisions among several projects using the same Redis server. On the other hand, there is the cache prefix to avoid collisions within the project itself.
# REDIS_PREFIX=laravel: # CACHE_PREFIX=cache Redis::set('foo', 'bar'); Cache::put('foo', 'bar');
With PhpRedis/Predis and a single Redis instance:
With PhpRedis and a Redis cluster:
With PhpRedis and a Redis cluster, after merging this PR: