Class: Galago::RateLimiter::MemcachedCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/galago/rate_limiter/memcached_counter.rb

Instance Method Summary collapse

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, options = {})
  @memcached.incr(key, amount, options[:expires_in], 1)
end

#reset!Object



12
13
14
# File 'lib/galago/rate_limiter/memcached_counter.rb', line 12

def reset!
  @memcached.flush
end