Skip to content

Commit

Permalink
Add docs for ConnectionPool#then
Browse files Browse the repository at this point in the history
  • Loading branch information
ianks authored and mperham committed Dec 3, 2020
1 parent 9105e96 commit 101ad1e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ $memcached.with do |conn|
end
```

You can also use `ConnectionPool#then` to support _both_ a
connection pool and a raw client (requires Ruby 2.5+).

```ruby
# Compatible with a raw Redis::Client, and ConnectionPool Redis
$redis.then { |r| r.set 'foo' 'bar' }
```

If all the objects in the connection pool are in use, `with` will block
until one becomes available. If no object is available within `:timeout` seconds,
`with` will raise a `Timeout::Error`.
Expand Down

0 comments on commit 101ad1e

Please sign in to comment.