This project is archived and is in readonly mode.
[Patch] Added Global expires_in for cache_store
-
CancelProfileIsBroken
- Tag changed from cache, mem_cache to bugmash, cache, mem_cache
-
Elad Meidar
+1 on idea, patch applies cleanly on 2-3-stable, tests pass (cause there aren't any :) ). Patch fails on master, i applied a patch too.
I can't believe this was missing up until now, seems like a pretty mandatory fix.I can't seem to find a proper way to test it, can't find any recollection of expires_in tests in neither *_cache_test.rb test... ideas?
-
jroes
I've attached a patch. The original patch moves the expires_in method to MemCacheStore. I preserved the original location in case another store needs to be able to default this. I also included a test.
Notice This is my first Rails patch. Please give me all the tips and suggestions you can.
-
Ben Marini
-1 on implementation. After some thought, I don't think this fits with the current cache setting api, or belongs in activesupport.
Currently, the api is:
config.cache_store = [symbol_for_cache_class], [extra args passed to constructor]For example:
ActionController::Base.cache_store = :mem_cache_store, "localhost"Thing is, MemCache does not take a default expires_in option in it's constructor. This functionality doesn't exist in the memcache-client gem. I think a better way to implement this would be a subclass of MemCache that accepts that option:
config.cache_store = MemCacheWithDefaultExpires.new "localhost", :expires_in => 10.minutesOr submit this patch to the memcache-client gem. It's not Rails's responsibility to add extra functionality on top of caching implementations.
-
John Guenin
-1 I agree with Ben. This functionality would make a great patch for the memcache-client gem, but does not belong in ActiveSupport.
-
CancelProfileIsBroken
- Tag changed from bugmash, cache, mem_cache to cache, mem_cache
- State changed from new to wontfix
Agreed. Good work, but this functionality belongs upstream from us.
