Class: PULCache
- Inherits:
-
HealthMonitor::Providers::Cache
- Object
- HealthMonitor::Providers::Cache
- PULCache
- Defined in:
- app/services/pul_cache.rb
Instance Method Summary collapse
Instance Method Details
#check! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/pul_cache.rb', line 8 def check! time = Time.now.utc.to_fs(:rfc2822) Rails.cache.write(key, time) fetched = Rails.cache.read(key) # NOTE: we might want to add logic to allow a small difference # here, but we let's not do this until we see if the issue persists # with this new implementation that calculates a better key. raise "different values (now: #{time}, fetched: #{fetched})" if fetched != time rescue RuntimeError => e raise PulCacheException, e. end |