This project is archived and is in readonly mode.
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
-
CancelProfileIsBroken September 25th, 2009 @ 12:22 PM
- Tag changed from active_support to active_support, bugmash
-
John Pignata September 26th, 2009 @ 10:16 PM
+1 on the change, verified that patch applies cleanly to master and tests pass
-
Prem Sichanugrist (sikachu) January 25th, 2010 @ 05:03 PM
- State changed from new to open
- Assigned user set to José Valim
+1 on this patch.
However, I found out that
CompressedMemCacheStore
tests doesn't work after apply your patch. So here's my another patch that adds documentation and properread_multi
toCompressedMemCacheStore
You need to apply
matthuhiggins
patch, then my patch :) Both of them can be applied on2-3-stable
andmaster
-
Rizwan Reza January 25th, 2010 @ 05:06 PM
- Tag changed from active_support, bugmash to active_support
-
José Valim February 2nd, 2010 @ 10:38 AM
- Assigned user changed from José Valim to Jeremy Kemper
I have limited knowledge on cache stores, so I can't tell what is the proper fix. Assigning to Jeremy.
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>