This project is archived and is in readonly mode.

#3672 ✓resolved
ronin-41535 (at lighthouseapp)

MemCacheStore does not work with Memcached::Rails

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

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.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages