Class: Headsail::Redis
- Inherits:
-
Object
- Object
- Headsail::Redis
- Defined in:
- lib/headsail/redis.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #add(data) ⇒ Object
-
#initialize(key_name) ⇒ Redis
constructor
A new instance of Redis.
Constructor Details
#initialize(key_name) ⇒ Redis
Returns a new instance of Redis.
7 8 9 10 11 |
# File 'lib/headsail/redis.rb', line 7 def initialize(key_name) @key_name = key_name setup_connection setup_task end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/headsail/redis.rb', line 5 def connection @connection end |
Instance Method Details
#add(data) ⇒ Object
13 14 15 16 17 |
# File 'lib/headsail/redis.rb', line 13 def add(data) @connection.lpush(@key_name, data) rescue setup_connection end |