Class: Rack::PooledThrottle::MemcachedThrottle
- Defined in:
- lib/rack/pooledthrottle/memcached_throttle.rb
Instance Attribute Summary
Attributes inherited from Throttle
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ MemcachedThrottle
constructor
A new instance of MemcachedThrottle.
- #query_cache?(request) ⇒ Boolean
Methods inherited from Throttle
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, ={}) super end |
Instance Method Details
#query_cache?(request) ⇒ 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 |