Class: DeadmanCheck::KeySet

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

Overview

KeySet Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, key) ⇒ KeySet

Returns a new instance of KeySet.



10
11
12
13
14
# File 'lib/deadman_check_keyset.rb', line 10

def initialize(host, port, key)
  @host = host
  @port = port
  @key  = key
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



8
9
10
# File 'lib/deadman_check_keyset.rb', line 8

def host
  @host
end

#keyObject

Returns the value of attribute key.



8
9
10
# File 'lib/deadman_check_keyset.rb', line 8

def key
  @key
end

#portObject

Returns the value of attribute port.



8
9
10
# File 'lib/deadman_check_keyset.rb', line 8

def port
  @port
end

Instance Method Details

#_update_redis_key(host, port, key) ⇒ Object



16
17
18
19
20
21
# File 'lib/deadman_check_keyset.rb', line 16

def _update_redis_key(host, port, key)
  epoch_time_now = DeadmanCheck::DeadmanCheckGlobal.new.get_epoch_time
  redis = Redis.new(:host => host, :port => port)
  redis.set(key, epoch_time_now)
  puts "Redis key #{key} updated EPOCH to #{epoch_time_now}"
end

#run_redis_key_updateObject



23
24
25
# File 'lib/deadman_check_keyset.rb', line 23

def run_redis_key_update
  _update_redis_key(@host, @port, @key)
end