class Rollie::RedisPool
Public Class Methods
create(options={})
click to toggle source
# File lib/rollie/redis_pool.rb, line 9 def create(options={}) pool_size = options[:pool_size] || 5 pool_timeout = options[:pool_timeout] || 1 ConnectionPool.new(:timeout => pool_timeout, :size => pool_size) do build_client(options) end end
Private Class Methods
build_client(options)
click to toggle source
# File lib/rollie/redis_pool.rb, line 20 def build_client(options) namespace = options[:namespace] || "Rollie" client = Redis.new redis_options(options) Redis::Namespace.new(namespace, redis: client) end
redis_options(options)
click to toggle source
# File lib/rollie/redis_pool.rb, line 26 def redis_options(options) redis = options.dup redis[:url] ||= ENV["REDIS_URL"] redis[:driver] ||= "ruby" redis.delete(:namespace) redis end