Class: Galago::RateLimiter::MemcachedCounter
- Inherits:
-
Object
- Object
- Galago::RateLimiter::MemcachedCounter
- Defined in:
- lib/galago/rate_limiter/memcached_counter.rb
Instance Method Summary collapse
- #increment(key, amount, options = {}) ⇒ Object
-
#initialize(client) ⇒ MemcachedCounter
constructor
A new instance of MemcachedCounter.
- #reset! ⇒ Object
Constructor Details
#initialize(client) ⇒ MemcachedCounter
4 5 6 |
# File 'lib/galago/rate_limiter/memcached_counter.rb', line 4 def initialize(client) @memcached = client end |
Instance Method Details
#increment(key, amount, options = {}) ⇒ Object
8 9 10 |
# File 'lib/galago/rate_limiter/memcached_counter.rb', line 8 def increment(key, amount, = {}) @memcached.incr(key, amount, [:expires_in], 1) end |
#reset! ⇒ Object
12 13 14 |
# File 'lib/galago/rate_limiter/memcached_counter.rb', line 12 def reset! @memcached.flush end |