Sha256: 42b9253a911ee382368b0d379de3c0fa34cafc683d06c6606042050a90df75a0
Contents?: true
Size: 776 Bytes
Versions: 1
Compression:
Stored size: 776 Bytes
Contents
require 'connection_pool' require 'redis' require 'redis-namespace' module HellaRedis module Connection def self.new(config) config = Config.new(config) if config.kind_of?(::Hash) ::ConnectionPool.new(:timeout => config.timeout, :size => config.size) do ::Redis::Namespace.new(config.redis_ns, { :redis => ::Redis.new({ :url => config.url, :driver => config.driver }) }) end end class Config attr_reader :url, :driver, :redis_ns, :timeout, :size def initialize(args) @url = args[:url] @driver = args[:driver] @redis_ns = args[:ns] @timeout = args[:timeout] @size = args[:size] || 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hella-redis-0.2.0 | lib/hella-redis/connection.rb |