Class: Faulty::Storage::Redis::Options
- Inherits:
-
Struct
- Object
- Struct
- Faulty::Storage::Redis::Options
- Includes:
- ImmutableOptions
- Defined in:
- lib/faulty/storage/redis.rb
Overview
Options for Faulty::Storage::Redis
Instance Attribute Summary collapse
-
#circuit_ttl ⇒ Integer
readonly
The maximum number of seconds to keep a circuit.
-
#client ⇒ Redis, ConnectionPool
readonly
The Redis instance or a ConnectionPool used to connect to Redis.
-
#key_prefix ⇒ String
readonly
A string prepended to all Redis keys used to store circuit state.
-
#key_separator ⇒ String
readonly
A string used to separate the parts of the Redis keys used to store circuit state.
-
#list_granularity ⇒ Integer
readonly
The number of seconds after which a new set is created to store circuit names.
-
#max_sample_size ⇒ Integer
readonly
The number of cache run entries to keep in memory for each circuit.
-
#sample_ttl ⇒ Integer
readonly
The maximum number of seconds to store a circuit run history entry.
Method Summary
Methods included from ImmutableOptions
Instance Attribute Details
#circuit_ttl ⇒ Integer (readonly)
Returns The maximum number of seconds to keep a circuit.
A value of nil
disables circuit expiration.
Default 604_800
(1 week).
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#client ⇒ Redis, ConnectionPool (readonly)
Returns The Redis instance or a ConnectionPool
used to connect to Redis. Default ::Redis.new
.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#key_prefix ⇒ String (readonly)
Returns A string prepended to all Redis keys used to store
circuit state. Default faulty
.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#key_separator ⇒ String (readonly)
Returns A string used to separate the parts of the Redis keys
used to store circuit state. Defaulty :
.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#list_granularity ⇒ Integer (readonly)
Returns The number of seconds after which a new set is
created to store circuit names. The old set is kept until
circuit_ttl expires. Default 3600
(1 hour).
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#max_sample_size ⇒ Integer (readonly)
Returns The number of cache run entries to keep in memory
for each circuit. Default 100
.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |
#sample_ttl ⇒ Integer (readonly)
Returns The maximum number of seconds to store a
circuit run history entry. Default 100
.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/faulty/storage/redis.rb', line 36 Options = Struct.new( :client, :key_prefix, :key_separator, :max_sample_size, :sample_ttl, :circuit_ttl, :list_granularity ) do include ImmutableOptions private def defaults { key_prefix: 'faulty', key_separator: ':', max_sample_size: 100, sample_ttl: 1800, circuit_ttl: 604_800, list_granularity: 3600 } end def required %i[list_granularity] end def finalize self.client = ::Redis.new unless client end end |