Class: Healthchecker::Checks::Cache

Inherits:
Healthchecker::Check show all
Defined in:
lib/healthchecker/checks/cache.rb

Instance Attribute Summary

Attributes inherited from Healthchecker::Check

#options

Instance Method Summary collapse

Methods inherited from Healthchecker::Check

#initialize, #perform_check

Constructor Details

This class inherits a constructor from Healthchecker::Check

Instance Method Details

#cache_keyObject



11
12
13
# File 'lib/healthchecker/checks/cache.rb', line 11

def cache_key
  options[:cache_key] || SecureRandom.hex
end

#check!Object



6
7
8
9
# File 'lib/healthchecker/checks/cache.rb', line 6

def check!
  return if Rails.cache.write(cache_key, 'ok', :expires_in => 1.second)
  raise 'Unable to write to rails cache.'
end