Module: Lunar::Connection
- Included in:
- Lunar
- Defined in:
- lib/lunar/connection.rb
Overview
This is actually taken from Ohm (ohm.keyvalue.org). The Lunar module extends this to make the API easier to use.
Lunar.connect(:host => "127.0.0.1", :port => "6380")
Lunar.redis
# basically returns Redis.new(:host => "127.0.0.1", :port => "6380")
# If you don't provide any connection, it assumes you are referring
# to the default redis host / port (127.0.0.1 on port 6379)
Lunar.redis
Instance Method Summary collapse
-
#connect(*options) ⇒ Object
Connect to a redis database.
-
#redis ⇒ Redis
models and instances.
- #redis=(connection) ⇒ Object
Instance Method Details
#connect(*options) ⇒ Object
Connect to a redis database.
23 24 25 26 |
# File 'lib/lunar/connection.rb', line 23 def connect(*) self.redis = nil @options = end |
#redis ⇒ Redis
models and instances.
32 33 34 |
# File 'lib/lunar/connection.rb', line 32 def redis threaded[:redis] ||= connection(*) end |
#redis=(connection) ⇒ Object
38 39 40 |
# File 'lib/lunar/connection.rb', line 38 def redis=(connection) threaded[:redis] = connection end |