class Rack::Healthcheck::Checks::Redis

Attributes

config[R]

Public Class Methods

new(name, config) click to toggle source

@param name [String] @param config [Hash<Symbol,String>] Hash with configs @param optional [Boolean] Flag used to inform if this service is optional @example name = Redis config = {

url: "redis://localhost:6379",
password: "pass",
optional: true

}

Calls superclass method Rack::Healthcheck::Checks::Base::new
# File lib/rack/healthcheck/checks/redis.rb, line 20
def initialize(name, config)
  super(name, Rack::Healthcheck::Type::CACHE, config[:optional], config[:url])
  @config = config
end

Private Instance Methods

check() click to toggle source
# File lib/rack/healthcheck/checks/redis.rb, line 27
def check
  redis = ::Redis.new(config)
  redis.info
  @status = true
rescue StandardError => _
  @status = false
end