class HealthMonitor::Providers::Cache
Constants
- EXPIRED_TIME_SECONDS
Public Instance Methods
Source
# File lib/health_monitor/providers/cache.rb, line 12 def check! time = Time.now.to_formatted_s(:rfc2822) Rails.cache.write(key, time, expires_in: EXPIRED_TIME_SECONDS) 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
Source
# File lib/health_monitor/providers/cache.rb, line 25 def key @key ||= ['health', request.try(:remote_ip)].join(':') end