Class: OkComputer::GenericCacheCheck
- Defined in:
- lib/ok_computer/built_in_checks/generic_cache_check.rb
Overview
Verifies that Rails can write to and read from its cache.
Constant Summary
Constants inherited from Check
Instance Attribute Summary
Attributes inherited from Check
#failure_occurred, #message, #registrant_name, #time
Instance Method Summary collapse
-
#check ⇒ Object
Public: Check whether cache can be written to and read from.
Methods inherited from Check
#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking
Instance Method Details
#check ⇒ Object
Public: Check whether cache can be written to and read from
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ok_computer/built_in_checks/generic_cache_check.rb', line 7 def check test_value.tap do |value| Rails.cache.write(cache_key, value) if value == Rails.cache.read(cache_key) "Able to read and write via #{humanize_cache_store_name}" else mark_failure "Value read from the cache does not match the value written" end end rescue => error mark_failure "Connection failure: #{error}" end |