class ActiveRedisDB::Key
Public Class Methods
destroy(key)
click to toggle source
# File lib/active_redis_db/key.rb, line 36 def destroy(key) client.del(normalize_key(key)) end
dump(key)
click to toggle source
# File lib/active_redis_db/key.rb, line 66 def dump(key) client.dump(normalize_key(key)) end
exists?(key)
click to toggle source
# File lib/active_redis_db/key.rb, line 6 def exists?(key) client.exists(normalize_key(key)) end
expire(key, seconds, format = :seconds)
click to toggle source
# File lib/active_redis_db/key.rb, line 44 def 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
Also aliased as: expire_in
expire_at(key, seconds, format = :seconds)
click to toggle source
# File lib/active_redis_db/key.rb, line 56 def 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
match(pattern = '*')
click to toggle source
# File lib/active_redis_db/key.rb, line 70 def match(pattern = '*') value = client.keys(normalize_key(pattern)) value = nil if value.empty? value end
migrate(key, options)
click to toggle source
# File lib/active_redis_db/key.rb, line 76 def migrate(key, options) client.migrate(normalize_key(key), options) end
move(key, destination)
click to toggle source
# File lib/active_redis_db/key.rb, line 80 def move(key, destination) client.move(normalize_key(key), destination) end
object(*args)
click to toggle source
# File lib/active_redis_db/key.rb, line 84 def object(*args) client.object(args) end
persist(key)
click to toggle source
# File lib/active_redis_db/key.rb, line 40 def persist(key) client.persist(normalize_key(key)) end
rename(key, value)
click to toggle source
# File lib/active_redis_db/key.rb, line 28 def rename(key, value) client.rename(normalize_key(key), value.to_s) end
rename!(key, value)
click to toggle source
# File lib/active_redis_db/key.rb, line 32 def rename!(key, value) client.renamenx(normalize_key(key), value.to_s) end
restore(key, milliseconds, value)
click to toggle source
# File lib/active_redis_db/key.rb, line 88 def restore(key, milliseconds, value) client.restore(normalize_key(key), milliseconds, value) end
sample()
click to toggle source
# File lib/active_redis_db/key.rb, line 24 def sample client.randomkey end
scan(cursor, opts = {})
click to toggle source
# File lib/active_redis_db/key.rb, line 92 def scan(cursor, opts = {}) client.scan(cursor, opts) end
sort(key, opts = {})
click to toggle source
# File lib/active_redis_db/key.rb, line 20 def sort(key, opts = {}) client.sort(normalize_key(key), opts) end
ttl?(key, format = :seconds)
click to toggle source
# File lib/active_redis_db/key.rb, line 14 def ttl?(key, format = :seconds) normalized_key = normalize_key(key) seconds?(format) ? client.ttl(normalized_key) : client.pttl(normalized_key) end
type?(key)
click to toggle source
# File lib/active_redis_db/key.rb, line 10 def type?(key) client.type(normalize_key(key)) end