Class: Memcache::Pool
- Inherits:
-
Object
- Object
- Memcache::Pool
- Defined in:
- lib/memcache.rb
Instance Attribute Summary collapse
-
#fallback ⇒ Object
Returns the value of attribute fallback.
Instance Method Summary collapse
- #[](scope) ⇒ Object
- #[]=(scope, cache) ⇒ Object
- #include?(scope) ⇒ Boolean
-
#initialize ⇒ Pool
constructor
A new instance of Pool.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Pool
Returns a new instance of Pool.
446 447 448 449 450 |
# File 'lib/memcache.rb', line 446 def initialize @cache_by_scope = {} @cache_by_scope[:default] = Memcache.new(:server => Memcache::LocalServer) @fallback = :default end |
Instance Attribute Details
#fallback ⇒ Object
Returns the value of attribute fallback.
444 445 446 |
# File 'lib/memcache.rb', line 444 def fallback @fallback end |
Instance Method Details
#[](scope) ⇒ Object
460 461 462 |
# File 'lib/memcache.rb', line 460 def [](scope) @cache_by_scope[scope.to_sym] || @cache_by_scope[fallback] end |
#[]=(scope, cache) ⇒ Object
464 465 466 |
# File 'lib/memcache.rb', line 464 def []=(scope, cache) @cache_by_scope[scope.to_sym] = cache end |
#include?(scope) ⇒ Boolean
452 453 454 |
# File 'lib/memcache.rb', line 452 def include?(scope) @cache_by_scope.include?(scope.to_sym) end |
#reset ⇒ Object
468 469 470 |
# File 'lib/memcache.rb', line 468 def reset @cache_by_scope.values.each {|c| c.reset} end |