Skip to content

Instantly share code, notes, and snippets.

View boffbowsh's full-sized avatar

Paul Bowsher boffbowsh

View GitHub Profile
require "securerandom"
class RollingCounter
# :call-seq: RollingCounter.new(redis_client, max_window_seconds) -> counter
#
# Create a new counter instance, that will store/retrieve counts with
# +redis_client+ and return counts within the last +max_window_seconds+
# seconds.
#