Class: RedisRds::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_rds/object.rb

Direct Known Subclasses

Hash, List, Set, SortedSet, String

Constant Summary collapse

@@namespace =
nil
@@connection =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redis_key) ⇒ Object

Returns a new instance of Object.



5
6
7
# File 'lib/redis_rds/object.rb', line 5

def initialize(redis_key)
  @redis_key = format_redis_key(redis_key)
end

Instance Attribute Details

#redis_keyObject

Returns the value of attribute redis_key.



3
4
5
# File 'lib/redis_rds/object.rb', line 3

def redis_key
  @redis_key
end

Class Method Details

.configure(options) ⇒ Object



15
16
17
18
# File 'lib/redis_rds/object.rb', line 15

def self.configure(options)
  @@namespace = options[:namespace]
  @@connection = options[:connection]
end

.connectionObject



20
21
22
# File 'lib/redis_rds/object.rb', line 20

def self.connection
  return @@connection
end

.flushdbObject



9
10
11
# File 'lib/redis_rds/object.rb', line 9

def self.flushdb
  connection.flushdb
end

Instance Method Details

#connectionObject



24
25
26
# File 'lib/redis_rds/object.rb', line 24

def connection
  return @@connection
end

#deleteObject



32
33
34
# File 'lib/redis_rds/object.rb', line 32

def delete
  return connection.del(@redis_key)
end

#dumpObject



48
49
50
# File 'lib/redis_rds/object.rb', line 48

def dump
  return connection.dump(@redis_key)
end

#exists?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/redis_rds/object.rb', line 52

def exists?
  return connection.exists(@redis_key)
end

#expire(expiry) ⇒ Object



40
41
42
# File 'lib/redis_rds/object.rb', line 40

def expire(expiry)
  return connection.expire(@redis_key, expiry)
end

#expireat(timestamp) ⇒ Object



44
45
46
# File 'lib/redis_rds/object.rb', line 44

def expireat(timestamp)
  return connection.expireat(@redis_key, timestamp.to_i)
end

#namespaceObject



28
29
30
# File 'lib/redis_rds/object.rb', line 28

def namespace
  return @@namespace
end

#persistObject



56
57
58
# File 'lib/redis_rds/object.rb', line 56

def persist
  return connection.persist(@redis_key)
end

#pttlObject



64
65
66
# File 'lib/redis_rds/object.rb', line 64

def pttl
  return connection.pttl(@redis_key)
end

#ttlObject



60
61
62
# File 'lib/redis_rds/object.rb', line 60

def ttl
  return connection.ttl(@redis_key)
end

#typeObject



36
37
38
# File 'lib/redis_rds/object.rb', line 36

def type
  return connection.type(@redis_key)
end