class Faulty::Cache::Rails
A wrapper for a Rails
or ActiveSupport cache
Public Class Methods
new(cache = ::Rails.cache, fault_tolerant: false)
click to toggle source
@param cache The Rails
cache to wrap @param fault_tolerant [Boolean] Whether the Rails
cache is
fault_tolerant. See {#fault_tolerant?} for more details
# File lib/faulty/cache/rails.rb, line 13 def initialize(cache = ::Rails.cache, fault_tolerant: false) @cache = cache @fault_tolerant = fault_tolerant end
Public Instance Methods
fault_tolerant?()
click to toggle source
Although ActiveSupport cache implementations are fault-tolerant, Rails.cache is not guranteed to be fault tolerant. For this reason, we require the user of this class to explicitly mark this cache as fault-tolerant using the {#initialize} parameter.
@return [Boolean]
# File lib/faulty/cache/rails.rb, line 31 def fault_tolerant? @fault_tolerant end