module RequestThrottler

Constants

VERSION

Public Instance Methods

incr(key) click to toggle source
# File lib/request_throttler.rb, line 12
def incr(key)
  val = RequestThrottler.store.incr(key)
  RequestThrottler.store.expire(key, RequestThrottler.time_to_expire) if val == 1
  val
end
threshold?(key, threshold_value = RequestThrottler.request_rpm_limit) click to toggle source
# File lib/request_throttler.rb, line 18
def threshold?(key, threshold_value = RequestThrottler.request_rpm_limit)
  incr(key) < threshold_value
end