8000 GitHub - phiggins/connection_pool: Generic connection pooling for Ruby
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

phiggins/connection_pool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Generic connection pooling for Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%
0