Class: RedisRds::Object
- Inherits:
-
Object
show all
- Defined in:
- lib/redis_rds/object.rb
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_key ⇒ Object
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
15
16
17
18
|
# File 'lib/redis_rds/object.rb', line 15
def self.configure(options)
@@namespace = options[:namespace]
@@connection = options[:connection]
end
|
.connection ⇒ Object
20
21
22
|
# File 'lib/redis_rds/object.rb', line 20
def self.connection
return @@connection
end
|
9
10
11
|
# File 'lib/redis_rds/object.rb', line 9
def self.flushdb
connection.flushdb
end
|
Instance Method Details
#connection ⇒ Object
24
25
26
|
# File 'lib/redis_rds/object.rb', line 24
def connection
return @@connection
end
|
32
33
34
|
# File 'lib/redis_rds/object.rb', line 32
def delete
return connection.del(@redis_key)
end
|
48
49
50
|
# File 'lib/redis_rds/object.rb', line 48
def dump
return connection.dump(@redis_key)
end
|
#exists? ⇒ 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
|
#namespace ⇒ Object
28
29
30
|
# File 'lib/redis_rds/object.rb', line 28
def namespace
return @@namespace
end
|
56
57
58
|
# File 'lib/redis_rds/object.rb', line 56
def persist
return connection.persist(@redis_key)
end
|
64
65
66
|
# File 'lib/redis_rds/object.rb', line 64
def pttl
return connection.pttl(@redis_key)
end
|
60
61
62
|
# File 'lib/redis_rds/object.rb', line 60
def ttl
return connection.ttl(@redis_key)
end
|
36
37
38
|
# File 'lib/redis_rds/object.rb', line 36
def type
return connection.type(@redis_key)
end
|