class Faulty::Cache::CircuitProxy

A circuit wrapper for cache backends

This class uses an internal {Circuit} to prevent the cache backend from causing application issues. If the backend fails continuously, this circuit will trip to prevent cascading failures. This internal circuit uses an independent in-memory backend by default.

Constants

Options

Options for {CircuitProxy}

@!attribute [r] circuit

@return [Circuit] A replacement for the internal circuit. When
  modifying this, be careful to use only a reliable circuit storage
  backend so that you don't introduce cascading failures.

@!attribute [r] notifier

@return [Events::Notifier] A Faulty notifier to use for failure
  notifications. If `circuit` is given, this is ignored.

Attributes

options[R]

Public Class Methods

new(cache, **options, &block) click to toggle source

@param cache [Cache::Interface] The cache backend to wrap @param options [Hash] Attributes for {Options} @yield [Options] For setting options in a block

# File lib/faulty/cache/circuit_proxy.rb, line 45
def initialize(cache, **options, &block)
  @cache = cache
  @options = Options.new(options, &block)
end

Public Instance Methods

fault_tolerant?() click to toggle source
# File lib/faulty/cache/circuit_proxy.rb, line 56
def fault_tolerant?
  @cache.fault_tolerant?
end