class StatusPage::Services::Cache

Public Instance Methods

check!() click to toggle source
# File lib/status-page/services/cache.rb, line 6
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/status-page/services/cache.rb, line 19
def key
  @key ||= ['status-cache', request.try(:remote_ip)].join(':')
end