Class: Faulty::Cache::CircuitProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/faulty/cache/circuit_proxy.rb

Overview

A circuit wrapper for cache backends

This class uses an internal Faulty::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.

Defined Under Namespace

Classes: Options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache, **options) {|Options| ... } ⇒ CircuitProxy

Returns a new instance of CircuitProxy.

Parameters:

Yields:

  • (Options)

    For setting options in a block


43
44
45
46
# File 'lib/faulty/cache/circuit_proxy.rb', line 43

def initialize(cache, **options, &block)
  @cache = cache
  @options = Options.new(options, &block)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.


12
13
14
# File 'lib/faulty/cache/circuit_proxy.rb', line 12

def options
  @options
end

Instance Method Details

#fault_tolerant?Boolean

Returns:

  • (Boolean)

54
55
56
# File 'lib/faulty/cache/circuit_proxy.rb', line 54

def fault_tolerant?
  @cache.fault_tolerant?
end