mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Support delete method for Redis
This commit is contained in:
parent
efdef7f45c
commit
ff15447f3a
2 changed files with 13 additions and 0 deletions
|
|
@ -36,6 +36,10 @@ module Rack
|
||||||
rescue Redis::BaseError
|
rescue Redis::BaseError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete(key, options={})
|
||||||
|
self.del(key)
|
||||||
|
rescue Redis::BaseError
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,15 @@ describe Rack::Attack::Cache do
|
||||||
@cache.read("cache-test-key").must_equal "foobar"
|
@cache.read("cache-test-key").must_equal "foobar"
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue