class RedisRds::Object

Attributes

redis_key[RW]

Public Class Methods

configure(options) click to toggle source
# File lib/redis_rds/object.rb, line 15
def self.configure(options)
  @@namespace = options[:namespace]
  @@connection = options[:connection]
end
connection() click to toggle source
# File lib/redis_rds/object.rb, line 20
def self.connection
  return @@connection
end
flushdb() click to toggle source
# File lib/redis_rds/object.rb, line 9
def self.flushdb
  connection.flushdb
end
new(redis_key) click to toggle source
# File lib/redis_rds/object.rb, line 5
def initialize(redis_key)
  @redis_key = format_redis_key(redis_key)
end

Public Instance Methods

connection() click to toggle source
# File lib/redis_rds/object.rb, line 24
def connection
  return @@connection
end
delete() click to toggle source
# File lib/redis_rds/object.rb, line 32
def delete
  return connection.del(@redis_key)
end
dump() click to toggle source
# File lib/redis_rds/object.rb, line 48
def dump
  return connection.dump(@redis_key)
end
exists?() click to toggle source
# File lib/redis_rds/object.rb, line 52
def exists?
  return connection.exists(@redis_key)
end
expire(expiry) click to toggle source
# File lib/redis_rds/object.rb, line 40
def expire(expiry)
  return connection.expire(@redis_key, expiry)
end
expireat(timestamp) click to toggle source
# File lib/redis_rds/object.rb, line 44
def expireat(timestamp)
  return connection.expireat(@redis_key, timestamp.to_i)
end
namespace() click to toggle source
# File lib/redis_rds/object.rb, line 28
def namespace
  return @@namespace
end
persist() click to toggle source
# File lib/redis_rds/object.rb, line 56
def persist
  return connection.persist(@redis_key)
end
pttl() click to toggle source
# File lib/redis_rds/object.rb, line 64
def pttl
  return connection.pttl(@redis_key)
end
ttl() click to toggle source
# File lib/redis_rds/object.rb, line 60
def ttl
  return connection.ttl(@redis_key)
end
type() click to toggle source
# File lib/redis_rds/object.rb, line 36
def type
  return connection.type(@redis_key)
end

Private Instance Methods

format_redis_key(key) click to toggle source
# File lib/redis_rds/object.rb, line 68
def format_redis_key(key)
  key = "#{namespace}:#{key}" unless key.start_with?(namespace)
  return key
end