class Norton::Objects::Hash

Attributes

key[R]
redis[R]

Public Class Methods

new(key, options = {}) click to toggle source
# File lib/norton/objects/hash.rb, line 6
def initialize(key, options = {})
  @key   = key
  @redis = Norton.pools[options[:pool_name] || :default]
end

Public Instance Methods

[](field)
Alias for: hget
[]=(field, value)
Alias for: hset
clear() click to toggle source

Redis: DEL

# File lib/norton/objects/hash.rb, line 64
def clear
  redis.with { |conn| conn.del(key) }
end
decr(field, by = 1)
Alias for: hdecrby
delete(*field)
Alias for: hdel
get(field)
Alias for: hget
has_key?(field)
Alias for: hexists
hdecrby(field, by = 1) click to toggle source

Redis: HINCRBY

# File lib/norton/objects/hash.rb, line 43
def hdecrby(field, by = 1)
  hincrby(field, -by)
end
Also aliased as: decr
hdel(*field) click to toggle source

Redis: HDEL

# File lib/norton/objects/hash.rb, line 31
def hdel(*field)
  redis.with { |conn| conn.hdel(key, field) }
end
Also aliased as: delete
hexists(field) click to toggle source

Redis: HEXISTS

# File lib/norton/objects/hash.rb, line 49
def hexists(field)
  redis.with { |conn| conn.hexists(key, field) }
end
Also aliased as: include?, has_key?, key?, member?
hget(field) click to toggle source

Redis: HGET

# File lib/norton/objects/hash.rb, line 18
def hget(field)
  redis.with { |conn| conn.hget(key, field) }
end
Also aliased as: get, []
hincrby(field, by = 1) click to toggle source

Redis: HINCRBY

# File lib/norton/objects/hash.rb, line 37
def hincrby(field, by = 1)
  redis.with { |conn| conn.hincrby(key, field, by) }
end
Also aliased as: incr
hkeys() click to toggle source

Redis: HEXISTS

# File lib/norton/objects/hash.rb, line 58
def hkeys
  redis.with { |conn| conn.hkeys(key) }
end
Also aliased as: keys
hmget(*field) click to toggle source

Redis: HMGET

# File lib/norton/objects/hash.rb, line 25
def hmget(*field)
  redis.with { |conn| conn.hmget(key, field) }
end
Also aliased as: mget
hset(field, value) click to toggle source

Redis: HSET

# File lib/norton/objects/hash.rb, line 12
def hset(field, value)
  redis.with { |conn| conn.hset(key, field, value) }
end
Also aliased as: []=
include?(field)
Alias for: hexists
incr(field, by = 1)
Alias for: hincrby
key?(field)
Alias for: hexists
keys()
Alias for: hkeys
member?(field)
Alias for: hexists
mget(*field)
Alias for: hmget