class ActiveOrm::Redis::Key

Public Class Methods

destroy(key) click to toggle source
# File lib/active_orm/redis/key.rb, line 36
def destroy(key)
  client.del(normalize_key(key))
end
dump(key) click to toggle source
# File lib/active_orm/redis/key.rb, line 64
def dump(key)
  client.dump(normalize_key(key))
end
exists?(key) click to toggle source
# File lib/active_orm/redis/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_orm/redis/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
expire_at(key, seconds, format = :seconds) click to toggle source
# File lib/active_orm/redis/key.rb, line 54
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_orm/redis/key.rb, line 68
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_orm/redis/key.rb, line 74
def migrate(key, options)
  client.migrate(normalize_key(key), options)
end
move(key, destination) click to toggle source
# File lib/active_orm/redis/key.rb, line 78
def move(key, destination)
  client.move(normalize_key(key), destination)
end
object(*args) click to toggle source
# File lib/active_orm/redis/key.rb, line 82
def object(*args)
  client.object(args)
end
persist(key) click to toggle source
# File lib/active_orm/redis/key.rb, line 40
def persist(key)
  client.persist(normalize_key(key))
end
rename(key, value) click to toggle source
# File lib/active_orm/redis/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_orm/redis/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_orm/redis/key.rb, line 86
def restore(key, milliseconds, value)
  client.restore(normalize_key(key), milliseconds, value)
end
sample() click to toggle source
# File lib/active_orm/redis/key.rb, line 24
def sample
  client.randomkey
end
scan(cursor, opts = {}) click to toggle source
# File lib/active_orm/redis/key.rb, line 90
def scan(cursor, opts = {})
  client.scan(cursor, opts)
end
sort(key, opts = {}) click to toggle source
# File lib/active_orm/redis/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_orm/redis/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_orm/redis/key.rb, line 10
def type?(key)
  client.type(normalize_key(key))
end