module Shoryuken
Public Class Methods
redis() { |conn| ... }
click to toggle source
# File lib/shoryuken/batch.rb, line 11 def self.redis raise ArgumentError, 'requires a block' unless block_given? redis_pool.with do |conn| retryable = true begin yield conn rescue Redis::CommandError => ex # Failover can cause the server to become a slave, need # to disconnect and reopen the socket to get back to the master. (conn.disconnect!; retryable = false; retry) if retryable && ex.message =~ /READONLY/ raise end end end
redis=(hash)
click to toggle source
# File lib/shoryuken/batch.rb, line 31 def self.redis=(hash) @redis = if hash.is_a?(ConnectionPool) hash else Shoryuken::RedisConnection.create(hash) end end
redis_pool()
click to toggle source
# File lib/shoryuken/batch.rb, line 27 def self.redis_pool @redis ||= Shoryuken::RedisConnection.create end