Class: Jylis::DataType::MVREG

Inherits:
Base
  • Object
show all
Defined in:
lib/jylis-rb/data_types/mvreg.rb

Overview

A multi-value register.

Instance Attribute Summary

Attributes inherited from Base

#connection

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Jylis::DataType::Base

Instance Method Details

#get(key) ⇒ Object

Get the latest value(s) for the register at ‘key`.



9
10
11
# File 'lib/jylis-rb/data_types/mvreg.rb', line 9

def get(key)
  connection.query("MVREG", "GET", key)
end

#set(key, value) ⇒ Object

Set the latest ‘value` for the register at `key`.



14
15
16
17
18
19
20
# File 'lib/jylis-rb/data_types/mvreg.rb', line 14

def set(key, value)
  result = connection.query("MVREG", "SET", key, value)

  unless result == "OK"
    raise "Failed: MVREG SET #{key} #{value}"
  end
end