Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

MemCacheStore does not work with Memcached::Rails

#3672

Lines 43-46 of activesupport/lib/active_support/cache/mem_cache_store.rb read:

  # Instead of addresses one can pass in a MemCache-like object. For example:
  #
  #   require 'memcached' # gem install memcached; uses C bindings to libmemcached
  #   ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211"))

However, actually trying to do this raises an ArgumentError ("wrong number of arguments (2 for 1)") since Memcached::Rails#delete (introduced in http://github.com/fauna/memcached/commit/0a5df4124076af585e726a372b...) only takes one argument.

Since memcached has deprecated support for an expiry on the delete operation in version 1.4, the memcache-client gem's MemCache#delete method ignores it in edge as well (as explained at http://github.com/mperham/memcache-client/blob/master/lib/memcache..... In previous versions, it provides a default argument value for expiry, so it supports calling the delete method with just the key.

Therefore, calling @data.delete(key) in MemCacheStore#delete is safe for usage with the memcache-client gem, and makes it usable with the memcached gem, as advertised (but not currently the case).

This patch adds a test that the underlying implementation is only called with one argument (the key) and changes the call.

Reported by ronin-41535 (at lighthouseapp) · January 8th, 2010 @ 10:20 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. ronin-41535 (at lighthouseapp)
    ronin-41535 (at lighthouseapp)
    • Tag changed from memcachestore to memcachestore, patch

    January 8th, 2010 @ 11:03 PM

  2. Gus
    Gus

    Makes sense to me. Let's bring the whole enchilada in line with reality.

    January 8th, 2010 @ 11:36 PM

  3. Scott Tamosunas
  4. Morten
  5. Steven Yan
  6. Kenny Buckler
  7. clay
    clay

    +3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160

    January 15th, 2010 @ 09:53 PM

  8. ronin-41535 (at lighthouseapp)
    ronin-41535 (at lighthouseapp)

    Are there any problems with the patch, bug report, or anything else with this ticket? Or is there some other reason that it's being ignored?

    March 2nd, 2010 @ 08:29 PM

  9. Repository
    Repository
    • State changed from new to resolved

    (from [edaf92f5ab4b44e789e526dfa8b93cb370e595cf]) Drop expires argument from call to @data in MemCacheStore so it works with memcache-client and memcached gems, as advertised [#3672 MemCacheStore does not work with Memcached::Rails state:resolved]

    Signed-off-by: wycats wycats@gmail.com
    http://github.com/rails/rails/commit/edaf92f5ab4b44e789e526dfa8b93c...

    March 28th, 2010 @ 09:57 PM