Class: GovukHealthcheck::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_app_config/govuk_healthcheck/redis.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



5
6
7
# File 'lib/govuk_app_config/govuk_healthcheck/redis.rb', line 5

def name
  :redis_connectivity
end

#statusObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/govuk_app_config/govuk_healthcheck/redis.rb', line 9

def status
  client = ::Redis.new

  key = "healthcheck-#{SecureRandom.hex}"

  client.set(key, "val")
  client.get(key)
  client.del(key)

  client.close

  GovukHealthcheck::OK
rescue StandardError
  GovukHealthcheck::CRITICAL
end