class HealthMonitor::Providers::Cache

Public Instance Methods

check!() click to toggle source
# 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

Private Instance Methods

key() click to toggle source
# File lib/health_monitor/providers/cache.rb, line 23
def key
  @key ||= ['health', request.try(:remote_ip)].join(':')
end