Class: Rack::PooledThrottle::MemcachedThrottle

Inherits:
Throttle
  • Object
show all
Defined in:
lib/rack/pooledthrottle/memcached_throttle.rb

Instance Attribute Summary

Attributes inherited from Throttle

#app, #options

Instance Method Summary collapse

Methods inherited from Throttle

#call

Constructor Details

#initialize(app, options = {}) ⇒ MemcachedThrottle

Returns a new instance of MemcachedThrottle.



4
5
6
# File 'lib/rack/pooledthrottle/memcached_throttle.rb', line 4

def initialize(app, options={})
  super
end

Instance Method Details

#query_cache?(request) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rack/pooledthrottle/memcached_throttle.rb', line 8

def query_cache?(request)
    ((pool.with {|cache| cache.incr(cache_key(request), 1, ttl, 1)}) <= max)
end