From 7e0ec9e3b152a09271e738e9085bce9dd0df5c21 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Mon, 27 Jul 2015 11:08:50 -0700 Subject: [PATCH] cleanup --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 64888f0..f07128a 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,10 @@ sections when a resource is not available, or conversely if you are comfortable blocking longer on a particular resource. This is not implemented in the below `ConnectionPool::Wrapper` class. +## Migrating to a Connection Pool + You can use `ConnectionPool::Wrapper` to wrap a single global connection, -making it easier to port your connection code over time: +making it easier to migrate existing connection code over time: ``` ruby $redis = ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Redis.connect } @@ -69,6 +71,9 @@ end Once you've ported your entire system to use `with`, you can simply remove `Wrapper` and use the simpler and faster `ConnectionPool`. + +## Shutdown + You can shut down a ConnectionPool instance once it should no longer be used. Further checkout attempts will immediately raise an error but existing checkouts will work. @@ -79,7 +84,7 @@ cp.shutdown { |conn| conn.close } ``` Shutting down a connection pool will block until all connections are checked in and closed. -Note that shutting down is completely optional; Ruby's garbage collector will reclaim +**Note that shutting down is completely optional**; Ruby's garbage collector will reclaim unreferenced pools under normal circumstances. @@ -96,15 +101,6 @@ Notes exposed by Net::HTTP, Redis, Dalli, etc. - -Install -------- - -``` -$ gem install connection_pool -``` - - Author ------