Class: Kayvee::Clients::Redis
- Inherits:
-
Object
- Object
- Kayvee::Clients::Redis
- Includes:
- KeyValueStoreClient
- Defined in:
- lib/kayvee/clients/redis.rb
Overview
An redis backed kv store
Constant Summary
Constants included from KeyValueStoreClient
KeyValueStoreClient::InterfaceNotImplementedError, KeyValueStoreClient::OptionMissingError
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(options) ⇒ Redis
constructor
A new instance of Redis.
-
#read(path) ⇒ String\nil
The read string or nil if key does not exist.
- #size ⇒ Object
-
#write(path, value) ⇒ Key
The modified key.
Methods included from KeyValueStoreClient
Constructor Details
#initialize(options) ⇒ Redis
Returns a new instance of Redis.
14 15 16 17 18 19 |
# File 'lib/kayvee/clients/redis.rb', line 14 def initialize() @options = @store = ::Redis.new(url: 'redis://localhost') end |
Instance Method Details
#clear ⇒ Object
40 41 42 |
# File 'lib/kayvee/clients/redis.rb', line 40 def clear raise NotImplementedError end |
#read(path) ⇒ String\nil
Returns the read string or nil if key does not exist.
24 25 26 |
# File 'lib/kayvee/clients/redis.rb', line 24 def read(path) @store.get(_path(path)) end |
#size ⇒ Object
36 37 38 |
# File 'lib/kayvee/clients/redis.rb', line 36 def size raise NotImplementedError end |
#write(path, value) ⇒ Key
Returns the modified key.
32 33 34 |
# File 'lib/kayvee/clients/redis.rb', line 32 def write(path, value) @store.set(_path(path), value) end |