Class: RedisConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/app/models/redis_configuration.rb

Overview

Easily fetch the redis configuration from redis.yml in the config directory. There are several formats to support

URL with single server development:

url: 'redis://localhost:6379/0'

Host/port combination for single server development:

host: localhost
port: 6379
db: 0

Sentinel development:

master: production
sentinels:
  - host1:6379
  - host2:6379
  - host3:6379
role: master

Available for all options

connect_timeout: 0.2
read_timeout: 0.2
write_timeout: 0.2
timeout: 1

Class Method Summary collapse

Class Method Details

.load(database = nil) ⇒ Object

Load the configuration using the given DB

Trying first the URL, then host, then sentinel, then default method



42
43
44
# File 'lib/app/models/redis_configuration.rb', line 42

def load(database = nil)
  load_url(database) || load_host(database) || load_sentinel(database) || load_default(database)
end