Class: StatusPage::Services::Cache

Inherits:
Base
  • Object
show all
Defined in:
lib/status-page/services/cache.rb

Instance Attribute Summary

Attributes inherited from Base

#request

Instance Method Summary collapse

Methods inherited from Base

#config, config, config_class, configurable?, #initialize, service_name

Constructor Details

This class inherits a constructor from StatusPage::Services::Base

Instance Method Details

#check!Object



6
7
8
9
10
11
12
13
14
15
# 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