module Findable::Query::Connection

Public Instance Methods

redis() click to toggle source

Returns current connection or generate connection. @return [Redis] Redis connection

# File lib/findable/query/connection.rb, line 6
def redis
  @_redis ||= generate_redis_connection!
end

Private Instance Methods

generate_redis_connection!() click to toggle source

Generate connection with redis options or default connection. @return [Redis] Redis connection

# File lib/findable/query/connection.rb, line 13
def generate_redis_connection!
  redis_options ? Redis.new(**redis_options) : Redis.current
end
redis_options() click to toggle source

Returns redis options from configuration. @return [Hash] Redis options @return [nil] No Redis options

# File lib/findable/query/connection.rb, line 20
def redis_options
  Findable.config.redis_options.presence
end