Ruby library for accessing memcached.
Ruby
Pull request Compare This branch is 150 commits ahead, 1 commit behind fiveruns:master.
Latest commit a014dc2 Feb 4, 2013 @mperham Merge pull request #22 from jordimassaguerpla/master
add license information to the gemspec
Failed to load latest commit information.
bin Add memcached_top binary Mar 5, 2010
lib More work on encoding. Force values from socket to default_external. Jul 25, 2010
test Large value test, fix JRuby test, closes GH-14 Nov 28, 2010
.gitignore
FAQ.rdoc
History.rdoc Update changelog Jul 9, 2010
LICENSE.txt Pull socket timeout fixes from 37signals. Jan 14, 2009
README.rdoc Add deprecation note, link to Dalli Aug 31, 2010
Rakefile Remove VERSION.yml usage, release 1.8.1 Mar 20, 2010
memcache-client.gemspec add license information to gemspec Feb 4, 2013
performance.txt Final doc cleanup, release 1.7.6 Nov 3, 2009

README.rdoc

memcache-client

A ruby library for accessing memcached.

memcache-client is deprecated as of August 2010. It will be supported through 2010 but new code should use Dalli instead.

Source:

github.com/mperham/memcache-client

Installing memcache-client

Just install the gem:

$ sudo gem install memcache-client

Using memcache-client

With one server:

CACHE = MemCache.new 'localhost:11211'

Or with multiple servers:

CACHE = MemCache.new %w[one.example.com:11211 two.example.com:11211]

Tuning memcache-client

The MemCache.new method takes a number of options which can be useful at times. Please read the source comments there for an overview. If you are using Ruby 1.8.x and using multiple memcached servers, you should install the RubyInline gem for ultimate performance.

Using memcache-client with Rails

Rails 2.1+ includes memcache-client 1.5.0 out of the box. See ActiveSupport::Cache::MemCacheStore and the Rails.cache method for more details. Rails 2.3+ will use the latest memcache-client gem installed.

Using memcache-client with EventMachine

memcache-client 1.8.0 added support for native EventMachine connections using Ruby 1.9. If you are using an EventMachine-based application (e.g. thin), you can activate the EventMachine support like so:

require 'memcache'
require 'memcache/event_machine'

EM.run do
  Fiber.new do
    m = MemCache.new('localhost:11211')
    m.set 'abc', 'xyz'
    m.get 'abc'
  end.resume
end

Questions?

memcache-client is maintained by Mike Perham and was originally written by Bob Cottrell, Eric Hodel and the seattle.rb crew.

Email

mperham@gmail.com

Twitter

mperham

WWW

mikeperham.com

If my work on memcache-client is something you support, please take a moment to recommend me at WWR. I'm not asking for money, just a electronic “thumbs up”.