module StartHer::RedisClient

Public Instance Methods

real_client(options = {})
Alias for: client

Private Instance Methods

client(options = {}) click to toggle source
# File lib/start_her/redis_client.rb, line 11
def client(options = {})
  options = client_opts(options)
  client = ::Redis.new(options)

  if (namespace = options[:namespace])
    ::Redis::Namespace.new(namespace, redis: client)
  else
    client
  end
end
Also aliased as: real_client
client_opts(options) click to toggle source
# File lib/start_her/redis_client.rb, line 22
def client_opts(options)
  StartHer.config.redis.merge(options).dup.tap do |opts|
    if opts[:network_timeout]
      opts[:timeout] = opts[:network_timeout]
      opts.delete(:network_timeout)
    end

    opts[:driver] = opts[:driver] || 'ruby'
  end
end