class Faulty::Cache::Default
The default cache implementation
It tries to make a logical decision of what cache implementation to use based on the current environment.
-
If
Rails
is loaded, it will use Rails.cache -
If ActiveSupport is available, it will use an `ActiveSupport::Cache::MemoryStore`
-
Otherwise it will use a {Faulty::Cache::Null}
Public Class Methods
new()
click to toggle source
# File lib/faulty/cache/default.rb, line 16 def initialize @cache = if defined?(::Rails) Cache::Rails.new(::Rails.cache) elsif defined?(::ActiveSupport::Cache::MemoryStore) Cache::Rails.new(ActiveSupport::Cache::MemoryStore.new, fault_tolerant: true) else Cache::Null.new end end