class Jylis::DataType::PNCOUNT
A positive/negative counter.
Public Instance Methods
dec(key, value)
click to toggle source
Decrease the counter at `key` by the amount of `value`.
# File lib/jylis-rb/data_types/pncount.rb, line 24 def dec(key, value) result = connection.query("PNCOUNT", "DEC", key, value) unless result == "OK" raise "Failed: PNCOUNT DEC #{key} #{value}" end end
get(key)
click to toggle source
Get the resulting `value` for the counter at `key`.
@return [Integer]
# File lib/jylis-rb/data_types/pncount.rb, line 10 def get(key) connection.query("PNCOUNT", "GET", key) end
inc(key, value)
click to toggle source
Increase the counter at `key` by the amount of `value`.
# File lib/jylis-rb/data_types/pncount.rb, line 15 def inc(key, value) result = connection.query("PNCOUNT", "INC", key, value) unless result == "OK" raise "Failed: PNCOUNT INC #{key} #{value}" end end