Class: RedisConnection
- Inherits:
-
Object
- Object
- RedisConnection
- Defined in:
- lib/redis_connection.rb
Overview
Initialize a connection to Redis. Currently the path to redis socket is hardcoded (/tmp/redis.sock), as well as the driver (:hiredis). global variable $redis gets set.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(*args) ⇒ RedisConnection
constructor
A new instance of RedisConnection.
Constructor Details
#initialize(*args) ⇒ RedisConnection
Returns a new instance of RedisConnection.
15 16 17 18 19 20 |
# File 'lib/redis_connection.rb', line 15 def initialize *args #@key= key $redis ||= Redis.new(:path => "/tmp/redis.sock",:driver => :hiredis) @redis = $redis #puts green "Connected to Redis" end |
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
14 15 16 |
# File 'lib/redis_connection.rb', line 14 def redis @redis end |