diff --git a/lib/distributed_memoizer.rb b/lib/distributed_memoizer.rb index e80b687923a..3be926658a5 100644 --- a/lib/distributed_memoizer.rb +++ b/lib/distributed_memoizer.rb @@ -46,6 +46,11 @@ class DistributedMemoizer "memoize_" << key end + # Used for testing + def self.flush! + $redis.scan_each(match: "memoize_*").each { |key| $redis.del(key) } + end + protected def self.get_lock(redis, redis_lock_key) diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rb index b3613bea94f..7db1cdbb21b 100644 --- a/spec/requests/static_controller_spec.rb +++ b/spec/requests/static_controller_spec.rb @@ -9,7 +9,7 @@ describe StaticController do before { FinalDestination.stubs(:lookup_ip).returns("1.2.3.4") } after do - $redis.flushall + DistributedMemoizer.flush! end it 'returns the default favicon for a missing download' do