class Prop::RateLimited

Attributes

cache_key[RW]
description[RW]
first_throttled[RW]
handle[RW]
retry_after[RW]
threshold[RW]

Public Class Methods

new(options) click to toggle source
Calls superclass method
# File lib/prop/rate_limited.rb, line 6
def initialize(options)
  self.handle    = options.fetch(:handle)
  self.cache_key = options.fetch(:cache_key)
  self.first_throttled = options.fetch(:first_throttled)
  self.description = options[:description]

  interval  = options.fetch(:interval).to_i
  self.retry_after = interval - Time.now.to_i % interval

  self.threshold = options.fetch(:threshold)

  super(options.fetch(:strategy).threshold_reached(options))
end

Public Instance Methods

config() click to toggle source
# File lib/prop/rate_limited.rb, line 20
def config
  Prop.configurations.fetch(@handle)
end