On Oct 4, 6:41 am, Michael Koziarski <[EMAIL PROTECTED]> wrote: > That's just nasty... I assume someone's pinged Eric about the bug? I'm > hesitant to take unofficial upstream patches unless memcache-client is > 'officially' not getting any more updates. If there's some reason for > the patches not to be merged I'd hate to pull them and have our own fork > to maintain.
Yes, there is a bug that was last touched in September 2007. http://rubyforge.org/tracker/index.php?func=detail&aid=13721&group_id=1513&atid=5921 >From the comments, it appears that Eric is hesitant to apply the suggested change because he thinks the API for the memcache-client should not support non-string arguments. I agree that maintaining your own patches is less than ideal, so I am making the required changes in the MemCacheStore class instead of modifying the memcache-client. > > def test_increment > > @cache.write('foo', 1, :raw => true) > > assert_equal 1, @cache.read('foo', :raw => true) > > assert_equal 2, @cache.increment('foo') > > assert_equal 2, @cache.read('foo', :raw => true) > > end > > This seems like a good api, if you can make the changes and send a > patch, we can apply it. Obviously the memcache-client bug is another > issue but hopefully that can be resolved too. I had to change the required API slightly. I forgot that memcache- client will return a string when reading a value with :raw => true. Therefore, you need to also call to_i on the returned value to get the cache stores to be consistent. Separate counter manipulating methods are looking more and more attractive. def test_increment @cache.write('foo', 1, :raw => true) assert_equal 1, @cache.read('foo', :raw => true).to_i assert_equal 2, @cache.increment('foo') assert_equal 2, @cache.read('foo', :raw => true).to_i end I opened a ticket and uploaded a patch implementing the above API. http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1186-incrementdecrement-semantics-vary-between-railscache-stores -- Doug Barth --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
