class Kayvee::Clients::Redis
An redis backed kv store
Public Class Methods
new(options)
click to toggle source
@param [Hash] options for the client
# File lib/kayvee/clients/redis.rb, line 14 def initialize(options) @options = options validate_options! @store = ::Redis.new(url: 'redis://localhost') end
Public Instance Methods
clear()
click to toggle source
# File lib/kayvee/clients/redis.rb, line 40 def clear raise NotImplementedError end
read(path)
click to toggle source
@param [String] path the path to read
@return [Stringnil] the read string or nil if key does not exist
# File lib/kayvee/clients/redis.rb, line 24 def read(path) @store.get(_path(path)) end
size()
click to toggle source
# File lib/kayvee/clients/redis.rb, line 36 def size raise NotImplementedError end
write(path, value)
click to toggle source
@param [String] path the path to read @param [String] value the value to set
@return [Key] the modified key
# File lib/kayvee/clients/redis.rb, line 32 def write(path, value) @store.set(_path(path), value) end
Private Instance Methods
_path(path)
click to toggle source
# File lib/kayvee/clients/redis.rb, line 46 def _path(path) "kayvee:#{path}" end
validate_options!()
click to toggle source
# File lib/kayvee/clients/redis.rb, line 50 def validate_options! true end