Cache key time must be a fixnum

This commit is contained in:
Aaron Suggs 2012-08-15 18:15:49 -04:00
parent ab3a540834
commit f7a1eac521

View file

@ -11,7 +11,7 @@ module Rack
def count(unprefixed_key, period)
epoch_time = Time.now.to_i
expires_in = period - (epoch_time % period)
key = "#{prefix}:#{epoch_time/period}:#{unprefixed_key}"
key = "#{prefix}:#{(epoch_time/period).to_i}:#{unprefixed_key}"
result = store.increment(key, 1, :expires_in => expires_in)
# NB: Some stores return nil when incrementing uninitialized values
if result.nil?