Merge pull request #268 from grzuy/cleanup_self

Cleanup unnecessary self references
This commit is contained in:
Tieg Zaharia 2018-01-25 14:49:58 -05:00 committed by GitHub
commit 7048599054
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View file

@ -115,7 +115,7 @@ class Rack::Attack
def blacklisted_response
warn "[DEPRECATION] 'Rack::Attack.blacklisted_response' is deprecated. Please use 'blocklisted_response' instead."
self.blocklisted_response
blocklisted_response
end
end

View file

@ -13,31 +13,33 @@ module Rack
end
def read(key)
self.get(key, raw: true)
get(key, raw: true)
rescue Redis::BaseError
end
def write(key, value, options={})
if (expires_in = options[:expires_in])
self.setex(key, expires_in, value, raw: true)
setex(key, expires_in, value, raw: true)
else
self.set(key, value, raw: true)
set(key, value, raw: true)
end
rescue Redis::BaseError
end
def increment(key, amount, options={})
count = nil
self.pipelined do
count = self.incrby(key, amount)
self.expire(key, options[:expires_in]) if options[:expires_in]
pipelined do
count = incrby(key, amount)
expire(key, options[:expires_in]) if options[:expires_in]
end
count.value if count
rescue Redis::BaseError
end
def delete(key, options={})
self.del(key)
del(key)
rescue Redis::BaseError
end
end