Closed kostya closed 6 years ago
What type of integration do you have in mind? Connection pooling baked right in? Or would an example program do?
yes just baked in.
almost every concurrent/web applications need to add wrapper like this https://github.com/mperham/sidekiq.cr/blob/master/src/sidekiq/pool.cr#L55, why not add it inside.
So I guess the idea is to add a class Redis::Pool
, where one can do this:
pool = Redis::Pool.new(host: ..., port: ..., pool_size: 250)
pool.redis do |conn|
conn.set("mike", "rules") => "OK"
conn.get("mike") => "rules"
end
if code have 100~ redis calls it problem to wrap every call with pool.redis (too much noise)
How would such a program checkout/checkin a connection? Explicitly, like so?
conn = pool.checkout
...
pool.checkin(conn)
not really imagine where and this can be used. for subscription only, but it can be hardcoded. all other command just always checkin.
Sorry, I don't understand what you mean?
This is the API you had in mind?
this is very needed in concurrent applications.