Class: Skadi::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/skadi/engine.rb

Class Method Summary collapse

Class Method Details

.validate_cache_store!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/skadi/engine.rb', line 20

def self.validate_cache_store!
  # Only the anonymity sets uses the cache
  return unless Skadi.configuration.use_anonymity_sets

  # A different cache store is common for development and testing
  return if Rails.env.local?

  if Rails.cache.is_a?(ActiveSupport::Cache::NullStore)
    Rails.logger.warn("Skadi: anonymity sets are enabled but Rails.cache is a ActiveSupport::Cache::NullStore. The pepper won't be saved so anonymity sets have been disabled.")

    Skadi.configuration.use_anonymity_sets = false
  end

  if Rails.cache.is_a?(ActiveSupport::Cache::MemoryStore)
    Rails.logger.warn("Skadi: anonymity sets are enabled but Rails.cache is a ActiveSupport::Cache::MemoryStore. If Rails is running across multiple processes or servers, the pepper won't be shared across processes, breaking anonymity-set grouping. Use a shared store (SolidCache/Redis/Memcached).")
  end
end