Class: LogMagic::PersistanceLayer

Inherits:
Object
  • Object
show all
Defined in:
lib/log_magic/persistance_layer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePersistanceLayer

Returns a new instance of PersistanceLayer.



7
8
9
10
# File 'lib/log_magic/persistance_layer.rb', line 7

def initialize
  @redis = Redis.new
  @uuid = ::SecureRandom.uuid
end

Instance Attribute Details

#uuidObject (readonly)

Returns the value of attribute uuid.



5
6
7
# File 'lib/log_magic/persistance_layer.rb', line 5

def uuid
  @uuid
end

Instance Method Details

#add_value(key, value) ⇒ Object



12
13
14
# File 'lib/log_magic/persistance_layer.rb', line 12

def add_value(key, value)
  @redis.hset(uuid, key, value)
end

#retrieve_value(uuid, key) ⇒ Object



16
17
18
# File 'lib/log_magic/persistance_layer.rb', line 16

def retrieve_value(uuid, key)
  @redis.hget(uuid, key)
end