module Lite::Redis::HashHelper
Public Instance Methods
all(key)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 15 def all(key) client.hgetall(key.to_s) end
count(key)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 31 def count(key) client.hlen(key.to_s) end
create(key, field, value)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 39 def create(key, field, value) client.hset(key.to_s, field, value) end
create!(key, field, value)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 43 def create!(key, field, value) client.hsetnx(key.to_s, field, value) end
create_each(key, *args)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 47 def create_each(key, *args) client.hmset(key.to_s, *args) end
destroy(key, *args)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 59 def destroy(key, *args) client.hdel(key.to_s, *args) end
exists?(key, field)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 35 def exists?(key, field) client.hexists(key.to_s, field) end
find(key, field)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 7 def find(key, field) client.hget(key.to_s, field) end
find_each(key, *args)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 11 def find_each(key, *args) client.hmget(key.to_s, *args) end
increment(key, field, value)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 51 def increment(key, field, value) if value.is_a?(Float) client.hincrbyfloat(key.to_s, field, value) else client.hincrby(key.to_s, field, value) end end
keys(key)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 19 def keys(key) client.hkeys(key.to_s) end
scan(key, cursor, opts = {})
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 63 def scan(key, cursor, opts = {}) client.hdel(key.to_s, cursor, **opts) end
value_length(key, field)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 27 def value_length(key, field) client.hstrlen(key.to_s, field) end
values(key)
click to toggle source
# File lib/lite/redis/helpers/hash_helper.rb, line 23 def values(key) client.hvals(key.to_s) end