Method: Redis#initialize
- Defined in:
- lib/redis.rb
#initialize(options = {}) ⇒ Redis
Create a new client instance
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/redis.rb', line 71 def initialize( = {}) @monitor = Monitor.new = .dup [:reconnect_attempts] = 1 unless .key?(:reconnect_attempts) if ENV["REDIS_URL"] && SERVER_URL_OPTIONS.none? { |o| .key?(o) } [:url] = ENV["REDIS_URL"] end # Kept as state, not just a local: the RESP3->RESP2 fallback rebuilds @client and must re-apply # socket inheritance, otherwise fork safety would be silently lost after a downgrade. @inherit_socket = .delete(:inherit_socket) # HIMPORT fieldsets are server session state that dies with the physical connection; the # registry remembers each prepared schema so a lost session can be repaired (see the # himport_* overrides below). Deleted from @options so it never reaches RedisClient::Config. @himport_auto_prepare = .delete(:himport_auto_prepare) != false @himport_fieldsets = {} @subscription_client = nil @client = build_client end |