class ActiveOrm::Redis::Key < ActiveOrm::Redis def self.exists?(key) client.exists(normalize_key(key)) end def self.type?(key) client.type(normalize_key(key)) end def self.ttl?(key, format = :seconds) normalized_key = normalize_key(key) seconds?(format) ? client.ttl(normalized_key) : client.pttl(normalized_key) end def self.sort(key, opts = {}) client.sort(normalize_key(key), opts) end def self.sample client.randomkey end def self.rename(key, value) client.rename(normalize_key(key), value.to_s) end def self.rename!(key, value) client.renamenx(normalize_key(key), value.to_s) end def self.destroy(key) client.del(normalize_key(key)) end def self.persist(key) client.persist(normalize_key(key)) end def self.expire(key, seconds, format = :seconds) normalized_key = normalize_key(key) if seconds?(format) client.expire(normalized_key, seconds) else client.pexpire(normalized_key, seconds) end end def self.expire_at(key, seconds, format = :seconds) normalized_key = normalize_key(key) if seconds?(format) client.expireat(normalized_key, seconds) else client.pexpireat(normalized_key, seconds) end end def self.dump(key) client.dump(normalize_key(key)) end def self.match(pattern = '*') value = client.keys(normalize_key(pattern)) value = nil if value.empty? value end def self.migrate(key, options) client.migrate(normalize_key(key), options) end def self.move(key, destination) client.move(normalize_key(key), destination) end def self.object(*args) client.object(args) end def self.restore(key, milliseconds, value) client.restore(normalize_key(key), milliseconds, value) end def self.scan(cursor, opts = {}) client.scan(cursor, opts) end end