Sha256: 914201d35962099e69e4542041e66fe2a481441cc3595bcfa8e3549dc2bc1369

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 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="*")
    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

6 entries across 6 versions & 1 rubygems

Version Path
active_orm-2.2.0 lib/active_orm/redis/key.rb
active_orm-2.1.0 lib/active_orm/redis/key.rb
active_orm-2.0.2 lib/active_orm/redis/key.rb
active_orm-2.0.1 lib/active_orm/redis/key.rb
active_orm-2.0.0 lib/active_orm/redis/key.rb
active_orm-1.0.0 lib/active_orm/redis/key.rb