class OkComputer::GenericCacheCheck
Verifies that Rails can write to and read from its cache.
Public Instance Methods
Source
# 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) mark_message "Able to read and write via #{humanize_cache_store_name}" else mark_failure mark_message "Value read from the cache does not match the value written" end end rescue => error mark_failure mark_message "Connection failure: #{error}" end
Public: Check
whether cache can be written to and read from
Private Instance Methods
Source
# File lib/ok_computer/built_in_checks/generic_cache_check.rb, line 29 def cache_key "okc-generic-cache-check-#{Socket.gethostname}" end
Source
# File lib/ok_computer/built_in_checks/generic_cache_check.rb, line 33 def humanize_cache_store_name name = if Rails.application.config.cache_store.is_a? Array Rails.application.config.cache_store[0] else Rails.application.config.cache_store end name.to_s.humanize end
Source
# File lib/ok_computer/built_in_checks/generic_cache_check.rb, line 25 def test_value SecureRandom.hex end
Private: Generate a unique value each time we check