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
--
blog: www.lucaguidi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
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. -- blog:www.lucaguidi.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2008-Nov-01 16:32 UTC
Re: Rails.cache.write returns false with MemCacheStore
> 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.> Thank you. > > Best, > Luca. > -- > blog:www.lucaguidi.com > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---