Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby library for accessing memcached.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 FAQ.rdoc
Octocat-spinner-32 History.rdoc
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 memcache-client.gemspec
Octocat-spinner-32 performance.txt
README.rdoc

memcache-client

A ruby library for accessing memcached.

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”.

Something went wrong with that request. Please try again.