Sha256: 6b0abc3b7ebde62eff571f71fc178f03aa7e00c0ad4cd814f48e54ab4feac10c

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

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)
    seconds?(format) ? client.ttl(normalize_key(key)) : client.pttl(normalize_key(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)
    seconds?(format) ? client.expire(normalize_key(key), seconds) : client.pexpire(normalize_key(key), seconds)
  end

  def self.expire_at(key, seconds, format=:seconds)
    seconds?(format) ? client.expireat(normalize_key(key), seconds) : client.pexpireat(normalize_key(key), seconds)
  end

  def self.dump(key)
    client.dump(normalize_key(key))
  end

  def self.match(pattern='*'.freeze)
    value = client.keys(normalize_key(pattern))
    value = nil if value.empty?
    return(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.sort(key, opts={})
    client.sort(normalize_key(key), opts)
  end

  def self.scan(cursor, opts={})
    client.scan(cursor, opts)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_orm-2.4.0 lib/active_orm/redis/key.rb
active_orm-2.3.0 lib/active_orm/redis/key.rb