Module: Stockpile::DefaultRedisConfiguration
- Defined in:
- lib/stockpile/default_redis_configuration.rb
Overview
Stockpile::DefaultRedisConfiguration
Confiuration object for a single Redis database cache setup. Reads values out of environment, default values or uses configuration provided during runtime.
Class Method Summary collapse
- .configuration ⇒ Object
- .connection_timeout ⇒ Object
- .pool_configuration ⇒ Object
- .pool_size ⇒ Object
- .redis_configuration ⇒ Object
- .redis_url ⇒ Object
- .sentinels ⇒ Object
Class Method Details
.configuration ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/stockpile/default_redis_configuration.rb', line 26 def configuration [ { db: :default, pool_configuration: pool_configuration, redis_configuration: redis_configuration } ] end |
.connection_timeout ⇒ Object
50 51 52 |
# File 'lib/stockpile/default_redis_configuration.rb', line 50 def connection_timeout Stockpile.configuration.connection_timeout end |
.pool_configuration ⇒ Object
43 44 45 46 47 48 |
# File 'lib/stockpile/default_redis_configuration.rb', line 43 def pool_configuration { size: pool_size, timeout: connection_timeout } end |
.pool_size ⇒ Object
54 55 56 |
# File 'lib/stockpile/default_redis_configuration.rb', line 54 def pool_size Stockpile.configuration.connection_pool end |
.redis_configuration ⇒ Object
36 37 38 39 40 41 |
# File 'lib/stockpile/default_redis_configuration.rb', line 36 def redis_configuration { url: redis_url, sentinels: sentinels }.delete_if { |_k, v| v.nil? || v.empty? } end |
.redis_url ⇒ Object
58 59 60 |
# File 'lib/stockpile/default_redis_configuration.rb', line 58 def redis_url Stockpile.configuration.redis_url end |
.sentinels ⇒ Object
62 63 64 |
# File 'lib/stockpile/default_redis_configuration.rb', line 62 def sentinels Stockpile.configuration.sentinels end |