class ActiveOrm::Redis::Hash
Public Class Methods
all(key)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 18 def all(key) value = client.hgetall(normalize_key(key)) value = metamorph(value) if evaluate? value end
count(key)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 40 def count(key) client.hlen(normalize_key(key)) end
create(key, field, value)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 48 def create(key, field, value) client.hset(normalize_key(key), field, value) end
create!(key, field, value)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 52 def create!(key, field, value) client.hsetnx(normalize_key(key), field, value) end
create_each(key, *args)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 56 def create_each(key, *args) client.hmset(normalize_key(key), args) end
destroy(key, *args)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 70 def destroy(key, *args) client.hdel(normalize_key(key), args) end
exists?(key, field)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 44 def exists?(key, field) client.hexists(normalize_key(key), field) end
find(key, field)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 6 def find(key, field) value = client.hget(normalize_key(key), field) value = metamorph(value) if evaluate? value end
find_each(key, *args)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 12 def find_each(key, *args) value = client.hmget(normalize_key(key), args) value = metamorph(value) if evaluate? value end
increment(key, field, value)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 60 def increment(key, field, value) normalized_key = normalize_key(key) if value.is_a?(Float) client.hincrbyfloat(normalized_key, field, value) else client.hincrby(normalized_key, field, value) end end
keys(key)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 24 def keys(key) value = client.hkeys(normalize_key(key)) value = metamorph(value) if evaluate? value end
scan(key, cursor, opts = {})
click to toggle source
# File lib/active_orm/redis/hash.rb, line 74 def scan(key, cursor, opts = {}) client.hdel(normalize_key(key), cursor, opts) end
value_length(key, field)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 36 def value_length(key, field) client.hstrlen(normalize_key(key), field) end
values(key)
click to toggle source
# File lib/active_orm/redis/hash.rb, line 30 def values(key) value = client.hvals(normalize_key(key)) value = metamorph(value) if evaluate? value end