Class: HealthMonitor::Providers::Cache

Inherits:
Base
  • Object
show all
Defined in:
lib/health_monitor/providers/cache.rb

Instance Attribute Summary

Attributes inherited from Base

#configuration, #request

Instance Method Summary collapse

Methods inherited from Base

configurable?, configuration_class, configure, #initialize, provider_name

Constructor Details

This class inherits a constructor from HealthMonitor::Providers::Base

Instance Method Details

#check!Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/health_monitor/providers/cache.rb', line 10

def check!
  time = Time.now.to_s

  Rails.cache.write(key, time)
  fetched = Rails.cache.read(key)

  raise "different values (now: #{time}, fetched: #{fetched})" if fetched != time
rescue Exception => e
  raise CacheException.new(e.message)
end