redis.rb 290 B

1234567891011121314
  1. # frozen_string_literal: true
  2. redis_connection = Redis.new(
  3. url: ENV['REDIS_URL'],
  4. driver: :hiredis
  5. )
  6. namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
  7. if namespace
  8. Redis.current = Redis::Namespace.new(namespace, redis: redis_connection)
  9. else
  10. Redis.current = redis_connection
  11. end