class ActiveOrm::Redis::Hash < ActiveOrm::Redis def self.find(key, field) value = client.hget(normalize_key(key), field) value = metamorph(value) if evaluate? value end def self.find_each(key, *args) value = client.hmget(normalize_key(key), args) value = metamorph(value) if evaluate? value end def self.all(key) value = client.hgetall(normalize_key(key)) value = metamorph(value) if evaluate? value end def self.keys(key) value = client.hkeys(normalize_key(key)) value = metamorph(value) if evaluate? value end def self.values(key) value = client.hvals(normalize_key(key)) value = metamorph(value) if evaluate? value end def self.value_length(key, field) client.hstrlen(normalize_key(key), field) end def self.count(key) client.hlen(normalize_key(key)) end def self.exists?(key, field) client.hexists(normalize_key(key), field) end def self.create(key, field, value) client.hset(normalize_key(key), field, value) end def self.create!(key, field, value) client.hsetnx(normalize_key(key), field, value) end def self.create_each(key, *args) client.hmset(normalize_key(key), *args) end def self.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 def self.destroy(key, *args) client.hdel(normalize_key(key), *args) end def self.scan(key, cursor, opts = {}) client.hdel(normalize_key(key), cursor, opts) end end