Class: RailsErrorDashboard::Services::AnalyticsCacheManager

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_error_dashboard/services/analytics_cache_manager.rb

Overview

Infrastructure service: Clear analytics caches

Clears dashboard_stats, analytics_stats, and platform_comparison cache entries. Handles cache stores that don’t support delete_matched (e.g., SolidCache) gracefully.

Constant Summary collapse

CACHE_PATTERNS =
%w[
  dashboard_stats/*
  analytics_stats/*
  platform_comparison/*
].freeze

Class Method Summary collapse

Class Method Details

.clearObject

Clear all analytics caches



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_error_dashboard/services/analytics_cache_manager.rb', line 18

def self.clear
  if Rails.cache.respond_to?(:delete_matched)
    CACHE_PATTERNS.each { |pattern| Rails.cache.delete_matched(pattern) }
  else
    Rails.logger.info("Cache store doesn't support delete_matched, skipping cache clear") if Rails.logger
  end
rescue NotImplementedError => e
  Rails.logger.info("Cache store doesn't support delete_matched: #{e.message}") if Rails.logger
rescue => e
  Rails.logger.error("Failed to clear analytics cache: #{e.message}") if Rails.logger
end