diff --git a/lib/rack/attack/store_proxy/redis_store_proxy.rb b/lib/rack/attack/store_proxy/redis_store_proxy.rb index 56778985..6718a317 100644 --- a/lib/rack/attack/store_proxy/redis_store_proxy.rb +++ b/lib/rack/attack/store_proxy/redis_store_proxy.rb @@ -36,6 +36,10 @@ def increment(key, amount, options={}) rescue Redis::BaseError end + def delete(key, options={}) + self.del(key) + rescue Redis::BaseError + end end end end diff --git a/spec/integration/rack_attack_cache_spec.rb b/spec/integration/rack_attack_cache_spec.rb index 461162c8..11012b9f 100644 --- a/spec/integration/rack_attack_cache_spec.rb +++ b/spec/integration/rack_attack_cache_spec.rb @@ -80,6 +80,15 @@ def sleep_until_expired @cache.read("cache-test-key").must_equal "foobar" end end + + describe "delete" do + it "must delete the value" do + store.write(@key, "foobar", :expires_in => @expires_in) + @cache.read('cache-test-key').must_equal "foobar" + store.delete(@key) + @cache.read('cache-test-key').must_equal nil + end + end end end