Class: Kayvee::Clients::Memory
- Inherits:
-
Object
- Object
- Kayvee::Clients::Memory
- Includes:
- KeyValueStoreClient
- Defined in:
- lib/kayvee/clients/memory.rb
Overview
An in memory kv store
Direct Known Subclasses
Constant Summary
Constants included from KeyValueStoreClient
KeyValueStoreClient::InterfaceNotImplementedError, KeyValueStoreClient::OptionMissingError
Instance Method Summary collapse
-
#initialize(options) ⇒ Memory
constructor
A new instance of Memory.
-
#read(path) ⇒ String\nil
The read string or nil if key does not exist.
-
#write(path, value) ⇒ Key
The modified key.
Methods included from KeyValueStoreClient
Constructor Details
#initialize(options) ⇒ Memory
Returns a new instance of Memory.
8 9 10 11 12 |
# File 'lib/kayvee/clients/memory.rb', line 8 def initialize() @options = @store = {} end |
Instance Method Details
#read(path) ⇒ String\nil
Returns the read string or nil if key does not exist.
17 18 19 |
# File 'lib/kayvee/clients/memory.rb', line 17 def read(path) @store[path] end |
#write(path, value) ⇒ Key
Returns the modified key.
25 26 27 |
# File 'lib/kayvee/clients/memory.rb', line 25 def write(path, value) @store[path] = value end |