1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00
Generic connection pooling for Ruby
Find a file
Mike Perham 2eac7dcaa6 Merge pull request #6 from elabs/superclass-mismatch
Fix superclass mismatch for ConnectionPool in version.rb
2012-03-02 07:10:57 -08:00
lib Fix superclass mismatch for ConnectionPool in version.rb 2012-03-02 14:23:54 +01:00
test Smaller timeout. 2012-02-08 09:45:26 -08:00
.gitignore Initial pass at a generic connection pool 2011-05-14 12:29:51 -07:00
Changes.md Move timed_queue, prepare for release 2011-09-19 14:29:59 -07:00
connection_pool.gemspec Initial pass at a generic connection pool 2011-05-14 12:29:51 -07:00
Gemfile Suggestions from @brixen 2011-09-25 19:23:35 -07:00
LICENSE Add project info, tests 2011-05-14 15:36:17 -07:00
Rakefile Add project info, tests 2011-05-14 15:36:17 -07:00
README.md Update connection_pool to subclass BasicObject 2011-09-19 10:29:31 -07:00

connection_pool

Generic connection pooling for Ruby.

MongoDB has its own connection pool. ActiveRecord has its own connection pool. This is a generic connection pool that can be used with anything, e.g. Redis, Dalli and other Ruby network clients.

Requirements

connection_pool requires Ruby 1.9 because it uses BasicObject.

Install

gem install connection_pool

Usage

Create a pool of objects to share amongst the fibers or threads in your Ruby application:

@memcached = ConnectionPool.new(:size => 5, :timeout => 5) { Dalli::Client.new }

Then use the pool in your application:

@memcached.with_connection do |dalli|
  dalli.get('some-count')
end

Author

Mike Perham, @mperham, http://mikeperham.com