Rails.cache.write returns false with MemCacheStore

Rails.cache.write returns false with MemCacheStore even if the operation
was successful done.

result = Rails.cache.write('key', 'value')
Rails.cache.read('key') # => value
puts result # => false

The problem is trivial: MemCache#set doesn't return any result, so the
check performed by MemCacheStore#write will always fail.
http://github.com/rails/rails/tree/master/activesupport/lib/active_support/cache/mem_cache_store.rb#L41

The described behavior is related to memcache-client (1.5.0). I noticed
differences between the gem installed on my machine and the bundled one:

memcached-client (1.5.0) gem
http://pastie.org/296380

memcached-client (1.5.0) bundled
http://github.com/rails/rails/tree/master/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb#L322

I created a ticket and attached a patch to it
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1239-railscachewrite-returns-false-with-memcachestore

Best,
Luca

Would someone take care of this patch, please?
I believe it's an annoying problem that could be easily fixed,
hopefully before 2.2.1 comes out.
Thank you.

Best,
Luca.

Would someone take care of this patch, please?
I believe it's an annoying problem that could be easily fixed,
hopefully before 2.2.1 comes out.

The patch attached to that ticket is incorrect, all it does it hide it
by changing the require statements. We have a few options here:

1) Get our inline changes merged upstream into memcache-client. This
is preferably, obviously.
2) Increment the version of our bundled (forked) memcache-client so
the original doesn't get required
3) Tell people to uninstall the memcache-client gem if they want to
use the rails cache stuff with memcache.

So if you're keen to help out, you should extract those changes into a
patch, and submit it upstream to eric & co for memcache-client.

The problem should be fixed in memcache-client, of course, but until
now, we also cared about non Rails issues, in order to provide
consistent results. Ruby's pre-1.9 time marshaling bug fix (http://
tinyurl.com/5d32xn) is clear example.

The second solution seems to be the best one.
In the meanwhile I'll extract and send a patch for the mc team.

Luca