Method: Xunch::RedisClient#initialize
- Defined in:
- lib/xunch/shard/redis.rb
#initialize(options = {}) ⇒ RedisClient
Returns a new instance of RedisClient.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/xunch/shard/redis.rb', line 14 def initialize( = {}) = DEFAULTS.merge() if RUBY_PLATFORM =~ /mingw/ [:driver] = nil end if([:pool_timeout] <= 0) [:pool_timeout] = 1073741823 end last_driver = Redis::Connection.drivers.last.name [:driver] ||= last_driver[last_driver.rindex(':') + 1, last_driver.length].downcase.to_sym if [:driver] == :synchrony require "xunch/connection/fiber_redis_pool" @pool = FiberRedisPool.new() else require "xunch/connection/threaded_redis_pool" @pool = ThreadedRedisPool.new() end end |