/usr/lib/ruby/vendor_ruby/em-hiredis.rb is in ruby-em-hiredis 0.3.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | require 'eventmachine'
module EventMachine
module Hiredis
# All em-hiredis errors should descend from EM::Hiredis::Error
class Error < RuntimeError; end
# An error reply from Redis. The actual error retuned by ::Hiredis will be
# wrapped in the redis_error accessor.
class RedisError < Error
attr_accessor :redis_error
end
class << self
attr_accessor :reconnect_timeout
end
self.reconnect_timeout = 0.5
def self.setup(uri = nil)
uri = uri || ENV["REDIS_URL"] || "redis://127.0.0.1:6379/0"
client = Client.new
client.configure(uri)
client
end
# Connects to redis and returns a client instance
#
# Will connect in preference order to the provided uri, the REDIS_URL
# environment variable, or localhost:6379
#
# TCP connections are supported via redis://:password@host:port/db (only
# host and port components are required)
#
# Unix socket uris are supported, e.g. unix:///tmp/redis.sock, however
# it's not possible to set the db or password - use initialize instead in
# this case
def self.connect(uri = nil)
client = setup(uri)
client.connect
client
end
def self.logger=(logger)
@@logger = logger
end
def self.logger
@@logger ||= begin
require 'logger'
log = Logger.new(STDOUT)
log.level = Logger::WARN
log
end
end
autoload :Lock, 'em-hiredis/lock'
autoload :PersistentLock, 'em-hiredis/persistent_lock'
end
end
require 'em-hiredis/event_emitter'
require 'em-hiredis/connection'
require 'em-hiredis/base_client'
require 'em-hiredis/client'
require 'em-hiredis/pubsub_client'
|