Support for memcache server clusters #2

Closed
rtomayko opened this Issue May 26, 2009 · 1 comment

1 participant

@rtomayko
Owner

It's currently not possible to use more than a single memcached server for storage. Seth Faxon did some work on this and sent me a patch. Here's his email:

I spent some time this weekend modifying your Rack::Cache gem to work with the memcache-client gem. I needed it to work with multiple memcache servers, so I broke the URI convention you were using. I'm using it in a Rails app and the new config lines look like:

config.middleware.use(Rack::Cache,
 :verbose =>     true,
 :metastore =>   {:memcache => {:server => ['127.0.0.1:11211', '127.0.0.2:11211'], :namespace => 'nui_meta'}},
 :entitystore => {:memcache => {:server => ['127.0.0.1:11211', '127.0.0.2:11211'], :namespace => 'nui_entity'}})

The entity store and cachecontrol changes are pretty straight forward. I did change the MEMCACHE static variable to use the MemCache gem.

The other significant change was to metastore.rb, if the memcache server is down the response body returns nil. I added a check at line 63 of metastore.rb to put the body back after the read fails.

I'm planning on writing tests this afternoon, and just wanted to get some feedback from you to see if this is a direction you wanted to go. I have no desire to fork this, and if you have some feedback I would like to incorporate it.

Thanks for the great gem, this was my first time playing with Rack and I was able to jump in pretty quickly with the stuff you provided.

@rtomayko
Owner

Advanced memcached config, including server clusters

Closed by 05d2336

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment