module Lite::Redis::KeyHelper

Public Instance Methods

destroy(key) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 39
def destroy(key)
  client.del(key.to_s)
end
dump(key) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 65
def dump(key)
  client.dump(key.to_s)
end
exists?(key) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 7
def exists?(key)
  client.exists(key.to_s)
end
expire(key, seconds, format = :seconds) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 47
def expire(key, seconds, format = :seconds)
  if seconds?(format)
    client.expire(key.to_s, seconds)
  else
    client.pexpire(key.to_s, seconds)
  end
end
Also aliased as: expire_in
expire_at(key, seconds, format = :seconds) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 57
def expire_at(key, seconds, format = :seconds)
  if seconds?(format)
    client.expireat(key.to_s, seconds)
  else
    client.pexpireat(key.to_s, seconds)
  end
end
expire_in(key, seconds, format = :seconds)
Alias for: expire
match(pattern = '*') click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 69
def match(pattern = '*')
  client.keys(pattern.to_s)
end
migrate(key, options) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 73
def migrate(key, options)
  client.migrate(key.to_s, options)
end
move(key, destination) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 77
def move(key, destination)
  client.move(key.to_s, destination)
end
object(*args) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 81
def object(*args)
  client.object(*args)
end
persist(key) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 43
def persist(key)
  client.persist(key.to_s)
end
rename(key, value) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 31
def rename(key, value)
  client.rename(key.to_s, value.to_s)
end
rename!(key, value) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 35
def rename!(key, value)
  client.renamenx(key.to_s, value.to_s)
end
restore(key, milliseconds, value) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 85
def restore(key, milliseconds, value)
  client.restore(key.to_s, milliseconds, value)
end
sample() click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 27
def sample
  client.randomkey
end
scan(cursor, opts = {}) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 89
def scan(cursor, opts = {})
  client.scan(cursor, **opts)
end
sort(key, opts = {}) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 23
def sort(key, opts = {})
  client.sort(key.to_s, **opts)
end
ttl?(key, format = :seconds) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 15
def ttl?(key, format = :seconds)
  if seconds?(format)
    client.ttl(key.to_s)
  else
    client.pttl(key.to_s)
  end
end
type?(key) click to toggle source
# File lib/lite/redis/helpers/key_helper.rb, line 11
def type?(key)
  client.type(key.to_s)
end