class RedisRds::Hash

Public Instance Methods

[](key)
Alias for: get
[]=(key, value)
Alias for: set
all() click to toggle source
# File lib/redis_rds/hash.rb, line 51
def all
  return (getall || {}).with_indifferent_access
end
decr(key) click to toggle source
# File lib/redis_rds/hash.rb, line 43
def decr(key)
  return incrby(key, -1)
end
decrby(key, decrement) click to toggle source
# File lib/redis_rds/hash.rb, line 47
def decrby(key, decrement)
  return incrby(key, -decrement)
end
each(&block) click to toggle source

TODO: Implement lazy enumerator

# File lib/redis_rds/hash.rb, line 72
def each(&block)
  return all.each(&block)
end
get(key) click to toggle source
# File lib/redis_rds/hash.rb, line 5
def get(key)
  return connection.hget(@redis_key, key)
end
Also aliased as: []
getall() click to toggle source
# File lib/redis_rds/hash.rb, line 55
def getall
  return connection.hgetall(@redis_key)
end
incr(key) click to toggle source
# File lib/redis_rds/hash.rb, line 39
def incr(key)
  return incrby(key, 1)
end
incrby(key, increment) click to toggle source
# File lib/redis_rds/hash.rb, line 31
def incrby(key, increment)
  return connection.hincrby(@redis_key, key, increment)
end
key?(key) click to toggle source
# File lib/redis_rds/hash.rb, line 35
def key?(key)
  return connection.hexists(@redis_key, key)
end
keys() click to toggle source
# File lib/redis_rds/hash.rb, line 63
def keys
  return all.keys
end
mget(*_args) click to toggle source
# File lib/redis_rds/hash.rb, line 19
def mget(*_args)
  return connection.hmget(@redis_key, *arg)
end
mset(*args) click to toggle source
# File lib/redis_rds/hash.rb, line 15
def mset(*args)
  return connection.hmset(@redis_key, *args)
end
remove(key) click to toggle source
# File lib/redis_rds/hash.rb, line 27
def remove(key)
  return connection.hdel(@redis_key, key)
end
set(key, value) click to toggle source
# File lib/redis_rds/hash.rb, line 10
def set(key, value)
  return connection.hset(@redis_key, key, value)
end
Also aliased as: []=
setnx(key, value) click to toggle source
# File lib/redis_rds/hash.rb, line 23
def setnx(key, value)
  return connection.hsetnx(@redis_key, key, value)
end
to_json() click to toggle source
# File lib/redis_rds/hash.rb, line 67
def to_json
  return all.to_json
end
values() click to toggle source
# File lib/redis_rds/hash.rb, line 59
def values
  return all.values
end