-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9745e22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is there any rationale behind deprecating
Redis.current
? Having exactly one redis client per application was such a common use case, that people would have either used a global variable ($redis
) or if they knewRedis.current
existed use this one.Do you recommend building an own place to store the redis client if needed or any other alternative?
edit: For context, I've noticed the deprecation through a comment on https://stackoverflow.com/a/34673035/968531 and was wondering whether any general advice can be given
9745e22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because multi-threaded environments are very much the default these days, and sharing the same
Redis
instance between threads leads to tons of locking.So I prefer not to encourage this anymore. As you said it's super easy to just use
$redis
instead if that's really what you want.It's not the role of a database client to manage the lifecycle to the connection, it's up to the application to do that.
Yes. And you likely want to a connection pool with it.
9745e22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick response and pointing to the locking issue.