This project is archived and is in readonly mode.

#3189 ✓resolved
matthuhiggins

Add read_multi to ActiveSupport::Cache::Store

Reported by matthuhiggins | September 11th, 2009 @ 08:55 AM

I currently run unit tests with MemoryStore, and production with MemCacheStore. I use the 'read_multi' method provided by MemCacheStore, but read_multi is only available to MemCacheStore, so the code breaks in tests.

I realize that I can fix my tests by always using :memcache_store, and wrapping every test using 'with_local_cache' (defined in ActiveSupport::Cache::Strategy::LocalCache). However, this method is not documented, and I'm not sure if developers should be using this. If I'm testing incorrectly, this ticket is awash.

This patch adds 'read_multi' to the Rails.cache API. It duplicates the memcache behavior in that the arguments are flattened, and nonexistent keys are not included in the results.

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>

Pages