Class: Sensu::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/sensu/redis.rb

Class Method Summary collapse

Class Method Details

.connect(options = {}) ⇒ Object

Connect to Redis and ensure that the Redis version is at least 1.3.14, in order to support certain commands.

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (Object)

    Redis connection object.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sensu/redis.rb', line 12

def self.connect(options={})
  options ||= {}
  connection = EM::Protocols::Redis.connect(options)
  connection.info do |info|
    if info[:redis_version] < "1.3.14"
      klass = EM::Protocols::Redis::RedisError
      message = "redis version must be >= 2.0 RC 1"
      connection.error(klass, message)
    end
  end
  connection
end