Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'd like to change the Redis driver at runtime (in tests, to verify that a part of my package works both with predis and phpredis). I'm unable to do that because
RedisManager
seems to be a singleton whosedriver
property can't be changed.Changing the
driver
property onRedisManager
should allow to switch the connection driver. All methods for resolving connections use theconnector()
method which returns a connector instance based on the value of thedriver
property:framework/src/Illuminate/Redis/RedisManager.php
Lines 147 to 160 in 74b4267
I see that changing the Redis driver at runtime doesn't have much use in application code, unlike the database, because you can have multiple connections. However, it's impossible to test predis and phpredis support without this feature. If you don't want a setter, changing the visibility of the
driver
property to a public would work as well.