Class: Memcache::Pool
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.
Constructor Details
#initialize ⇒ Pool
Returns a new instance of Pool.
333 334 335 336 337 |
# File 'lib/memcache.rb', line 333 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.
331 332 333 |
# File 'lib/memcache.rb', line 331 def fallback @fallback end |
Instance Method Details
#[](scope) ⇒ Object
347 348 349 |
# File 'lib/memcache.rb', line 347 def [](scope) @cache_by_scope[scope.to_sym] || @cache_by_scope[fallback] end |
#[]=(scope, cache) ⇒ Object
351 352 353 |
# File 'lib/memcache.rb', line 351 def []=(scope, cache) @cache_by_scope[scope.to_sym] = cache end |
#include?(scope) ⇒ Boolean
339 340 341 |
# File 'lib/memcache.rb', line 339 def include?(scope) @cache_by_scope.include?(scope.to_sym) end |