redis / hiredis-rb

Ruby wrapper for hiredis
BSD 3-Clause "New" or "Revised" License
320 stars 90 forks source link

Usage instructions are unclear #47

Closed mrchucho closed 8 years ago

mrchucho commented 8 years ago

To use hiredis-rb with redis-rb, do I need to specify the driver when creating a connection?

Redis.new(url:'redis://localhost:6379/0', driver: :hiredis)

Or is it sufficient to follow the instructions and just do the following?

gem "hiredis", "~> 0.6.0"
gem "redis", ">= 3.2.0", :require => ["redis", "redis/connection/hiredis"]

and

Redis.new(url: 'redis://localhost:6379/0')

Or do I need to do both?

badboy commented 8 years ago

If nothing else is specified, the last loaded driver will be used. So if you explicitely load redis/connection/hiredis, hiredis will be used. IMO you should just make it explicit in the code and use :driver => :hiredis, so everyone sees it right away when reading the code, instead of relying on Gemfile magic.

mrchucho commented 8 years ago

Thanks for the quick response!