Class: RubyPitaya::RedisService
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- RubyPitaya::RedisService
- Defined in:
- lib/rubypitaya/core/app/services/redis_service.rb
Instance Method Summary collapse
- #client ⇒ Object
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize(setup) ⇒ RedisService
constructor
A new instance of RedisService.
Methods inherited from ServiceBase
Constructor Details
#initialize(setup) ⇒ RedisService
Returns a new instance of RedisService.
8 9 10 11 |
# File 'lib/rubypitaya/core/app/services/redis_service.rb', line 8 def initialize(setup) @redis = nil @redis_address = setup['rubypitaya.redis.url'] end |
Instance Method Details
#client ⇒ Object
26 27 28 |
# File 'lib/rubypitaya/core/app/services/redis_service.rb', line 26 def client @redis end |
#connect ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/rubypitaya/core/app/services/redis_service.rb', line 13 def connect @redis = Redis.new( url: @redis_address, :reconnect_attempts => [1.5]*10, ) @redis.ping end |
#disconnect ⇒ Object
22 23 24 |
# File 'lib/rubypitaya/core/app/services/redis_service.rb', line 22 def disconnect @redis.close end |