class HttpThreshold::Cache
Attributes
prefix[RW]
Public Class Methods
new()
click to toggle source
# File lib/http_threshold/cache.rb, line 6 def initialize self.store = ::Rails.cache if defined?(::Rails.cache) @prefix = 'threshold' end
Public Instance Methods
read_count(unprefixed_key, period)
click to toggle source
# File lib/http_threshold/cache.rb, line 11 def read_count(unprefixed_key, period) key, _ = key_and_expiry(unprefixed_key, period) store.read(key).to_i end