Class: FastCache::Connection
- Inherits:
-
Object
- Object
- FastCache::Connection
- Includes:
- Memcache::Protocol
- Defined in:
- lib/fastcache/interface/connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bucket_class ⇒ Object
Returns the value of attribute bucket_class.
-
#hash_class ⇒ Object
Returns the value of attribute hash_class.
-
#marshal_module ⇒ Object
Returns the value of attribute marshal_module.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(nodes, opts) ⇒ Connection
constructor
A new instance of Connection.
Methods included from Memcache::Protocol
#add, #cas, #decr, #delete, #flush_all_caches, #flush_cache, #get, #incr, #replace, #reset_connections, #set, #stats
Constructor Details
#initialize(nodes, opts) ⇒ Connection
Returns a new instance of Connection.
7 8 9 10 11 12 |
# File 'lib/fastcache/interface/connection.rb', line 7 def initialize(nodes, opts) @nodes = nodes.map {|(host, port)| FastCache::Memcache::Node.new(host, port)} @bucket_class = FastCache::ModulusBucket @hash_class = FastCache::CRC32 @marshal_module = Marshal # Ruby's built in marshal end |
Instance Attribute Details
#bucket_class ⇒ Object
Returns the value of attribute bucket_class.
4 5 6 |
# File 'lib/fastcache/interface/connection.rb', line 4 def bucket_class @bucket_class end |
#hash_class ⇒ Object
Returns the value of attribute hash_class.
4 5 6 |
# File 'lib/fastcache/interface/connection.rb', line 4 def hash_class @hash_class end |
#marshal_module ⇒ Object
Returns the value of attribute marshal_module.
4 5 6 |
# File 'lib/fastcache/interface/connection.rb', line 4 def marshal_module @marshal_module end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
5 6 7 |
# File 'lib/fastcache/interface/connection.rb', line 5 def nodes @nodes end |
Instance Method Details
#close ⇒ Object
14 15 16 |
# File 'lib/fastcache/interface/connection.rb', line 14 def close @nodes.each do |node| node.close end end |