-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for redis connection pools #839
Conversation
@jnunemaker could you rerun the failed test? |
@j-castellanos Thanks for the PR! In #826 (review) I offered a couple suggestions of how I think we should approach connection pool support. I don't really love having different adapters Redis depending on if you're using the client directly or a connection pool. I'd rather see I don't feel strongly between those two approaches, but I would like to make sure we add connection pool support to both Thoughts? |
d0c5845
to
d5d76ba
Compare
@bkeepers how is this? |
d5d76ba
to
a55636d
Compare
def initialize(client_or_pool = nil, key_prefix: nil) | ||
@pool = nil | ||
@client = nil | ||
if client_or_pool.respond_to?(:with) |
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.
Maybe is_a?(ConnectionPool)
might be better
removing idea fixing specs
a55636d
to
6e80bcb
Compare
@jnunemaker @bkeepers thoughts on this one? |
I don't want to add more methods to Flipper::Adapter. I think I'd just make redis and redis cache work with a client or a pool. That seems like easiest way. def client(&block)
# if client, then yield that, if connection pool then call with and yield client
end
# then change all methods that use @client to use client { |c| c.blah... } We could just abstract a method for getting a client and if adapter was initialized with pool it will use with and a block. If initialize with a client the client would just be used. I'll make a note to whip something together or anyone else is free to try sooner. |
To solve this issue #609 in a DRY way I simply wrap all the public methods in the existing redis adapter