class Jylis::DataType::TREG
A timestamped register.
Public Instance Methods
get(key)
click to toggle source
Get the latest `value` and `timestamp` for the register at `key`.
@return [Jylis::DataType::TREG::Result]
# File lib/jylis-rb/data_types/treg.rb, line 51 def get(key) result = connection.query("TREG", "GET", key) Result.parse(result) end
set(key, value, timestamp)
click to toggle source
Set a `value` and `timestamp` for the register at `key`.
@param timestamp [Integer, String] a unix or iso8601 formatted timestamp
# File lib/jylis-rb/data_types/treg.rb, line 60 def set(key, value, timestamp) timestamp = Time.parse(timestamp).utc.to_i if timestamp.is_a?(String) result = connection.query("TREG", "SET", key, value, timestamp) unless result == "OK" raise "Failed: TREG SET #{key} #{value} #{timestamp}" end end