class Redic::Sentinels

Constants

VERSION

Attributes

db[R]
hosts[R]
master_name[R]
password[R]
redis[R]
timeout[R]

Public Class Methods

new(options) click to toggle source
# File lib/redic/sentinels.rb, line 13
def initialize(options)
  @hosts       = options.fetch(:hosts)
  @master_name = options.fetch(:master_name)
  @password    = options[:password]
  @db          = options.fetch(:db, 0)
  @timeout     = options[:timeout]
  @max_retries = options.fetch(:max_retries, 3)

  establish_connection
end

Public Instance Methods

buffer() click to toggle source
# File lib/redic/sentinels.rb, line 45
def buffer
  forward { redis.buffer }
end
call(*args) click to toggle source
# File lib/redic/sentinels.rb, line 24
def call(*args)
  forward { redis.call *args }
end
call!(*args) click to toggle source
# File lib/redic/sentinels.rb, line 28
def call!(*args)
  forward { redis.call! *args }
end
clear() click to toggle source
# File lib/redic/sentinels.rb, line 53
def clear
  forward { redis.clear }
end
client() click to toggle source
# File lib/redic/sentinels.rb, line 57
def client
  forward { redis.client }
end
commit() click to toggle source
# File lib/redic/sentinels.rb, line 36
def commit
  buffer = redis.buffer

  forward do
    redis.buffer.replace(buffer)
    redis.commit
  end
end
queue(*args) click to toggle source
# File lib/redic/sentinels.rb, line 32
def queue(*args)
  forward { redis.queue *args }
end
reset() click to toggle source
# File lib/redic/sentinels.rb, line 49
def reset
  forward { redis.reset }
end
url() click to toggle source
# File lib/redic/sentinels.rb, line 61
def url
  forward { redis.url }
end

Private Instance Methods

forward() { || ... } click to toggle source
# File lib/redic/sentinels.rb, line 69
def forward
  yield.tap do |result|
    @retry_attempts = 0
  end