Sha256: 45f350120ee3791e2f172ac407ea1c1ba1ace991772222cb4263254f5521184c
Contents?: true
Size: 650 Bytes
Versions: 5
Compression:
Stored size: 650 Bytes
Contents
# frozen_string_literal: true module Motor module Alerts module ScheduledAlertsCache UPDATE_ALERTS_TASK = Concurrent::TimerTask.new( execution_interval: 2.minutes ) { Motor::Alerts::ScheduledAlertsCache.load_alerts } CACHE_STORE = ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes) module_function def all ActiveRecord::Base.logger.silence do CACHE_STORE.fetch(Motor::Alert.all.maximum(:updated_at)) do clear Motor::Alert.all.active.enabled.to_a end end end def clear CACHE_STORE.clear end end end end
Version data entries
5 entries across 5 versions & 1 rubygems