Class: Hikki::Adapters::MemcacheAdapter
- Inherits:
-
Adapter
- Object
- Adapter
- Hikki::Adapters::MemcacheAdapter
- Defined in:
- lib/hikki/adapters/memcache_adapter.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#uuid_generator ⇒ Object
readonly
Returns the value of attribute uuid_generator.
Instance Method Summary collapse
- #collection_for(collection) ⇒ Object
-
#initialize(connection = Dalli::Client.new('localhost:11211', { namespace: 'hikki', compress: true }), uuid_generator = SecureRandom) ⇒ MemcacheAdapter
constructor
A new instance of MemcacheAdapter.
Constructor Details
#initialize(connection = Dalli::Client.new('localhost:11211', { namespace: 'hikki', compress: true }), uuid_generator = SecureRandom) ⇒ MemcacheAdapter
Returns a new instance of MemcacheAdapter.
9 10 11 12 13 |
# File 'lib/hikki/adapters/memcache_adapter.rb', line 9 def initialize(connection=Dalli::Client.new('localhost:11211', { namespace: 'hikki', compress: true }), uuid_generator=SecureRandom) super() @connection = connection @uuid_generator = uuid_generator end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/hikki/adapters/memcache_adapter.rb', line 7 def connection @connection end |
#uuid_generator ⇒ Object (readonly)
Returns the value of attribute uuid_generator.
7 8 9 |
# File 'lib/hikki/adapters/memcache_adapter.rb', line 7 def uuid_generator @uuid_generator end |
Instance Method Details
#collection_for(collection) ⇒ Object
15 16 17 |
# File 'lib/hikki/adapters/memcache_adapter.rb', line 15 def collection_for(collection) collections.fetch(collection, MemcacheCollection.new(collection, connection, uuid_generator)) end |