Class: StatusPage::Services::Redis
- Defined in:
- lib/status-page/services/redis.rb
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#config, config, configurable?, #initialize, service_name
Constructor Details
This class inherits a constructor from StatusPage::Services::Base
Class Method Details
.config_class ⇒ Object
15 16 17 |
# File 'lib/status-page/services/redis.rb', line 15 def config_class Redis::Configuration end |
Instance Method Details
#check! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/status-page/services/redis.rb', line 20 def check! time = Time.now.to_s(:db) redis = ::Redis.new(url: config.url) redis.set(key, time) fetched = redis.get(key) raise "different values (now: #{time}, fetched: #{fetched})" if fetched != time rescue Exception => e raise RedisException.new(e.) ensure redis.close end |