Class: NagiosResque::Check::ResqueRedis

Inherits:
Object
  • Object
show all
Defined in:
lib/nagios_resque/check.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ResqueRedis

Returns a new instance of ResqueRedis.



53
54
55
56
# File 'lib/nagios_resque/check.rb', line 53

def initialize(options)
  @namespace = options.delete(:namespace)
  @redis = Redis.new options.merge(:thread_safe => true)
end

Instance Method Details

#get(key) ⇒ Object



62
63
64
# File 'lib/nagios_resque/check.rb', line 62

def get(key)
  @redis.get namespaced(key)
end

#lrem(key, count, value) ⇒ Object



68
69
70
# File 'lib/nagios_resque/check.rb', line 68

def lrem(key, count, value)
  @redis.lrem namespaced(key), count, value
end

#namespaced(key) ⇒ Object



58
59
60
# File 'lib/nagios_resque/check.rb', line 58

def namespaced(key)
  "#{@namespace}:#{key}"
end

#rpush(key, value) ⇒ Object



71
72
73
# File 'lib/nagios_resque/check.rb', line 71

def rpush(key, value)
  @redis.rpush namespaced(key), value
end

#sadd(key, value) ⇒ Object



65
66
67
# File 'lib/nagios_resque/check.rb', line 65

def sadd(key, value)
  @redis.sadd namespaced(key), value
end