class Jylis::DataType::GCOUNT

A grow-only counter.

@see jemc.github.io/jylis/docs/types/gcount/

Public Instance Methods

get(key) click to toggle source

Get the resulting `value` for the counter at `key`.

@return [Integer]

# File lib/jylis-rb/data_types/gcount.rb, line 10
def get(key)
  connection.query("GCOUNT", "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/gcount.rb, line 15
def inc(key, value)
  result = connection.query("GCOUNT", "INC", key, value)

  unless result == "OK"
    raise "Failed: GCOUNT INC #{key} #{value}"
  end
end