Sha256: b1fbc70bc3d447dae56d29d5e663dc4a1f1ff0501c7a0d173767852649bc9164
Contents?: true
Size: 557 Bytes
Versions: 1
Compression:
Stored size: 557 Bytes
Contents
require 'redis' require 'congestion/version' require 'congestion/rate_limiter' module Congestion class << self attr_accessor :default_options attr_accessor :redis end self.default_options = { namespace: 'congestion', # Redis key namespace interval: 1, # 1 second max_in_interval: 1, # 1 / second min_delay: 0, # none track_rejected: false } self.redis = ->{ Redis.new } def self.request(key, opts = { }) RateLimiter.new redis.call, key, default_options.merge(opts) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
congestion-0.0.2 | lib/congestion.rb |