Sha256: a60d51cfe2e411b9c71be6d0d4c3aa9121328889e7d20fa13606cd276160f9b8
Contents?: true
Size: 661 Bytes
Versions: 4
Compression:
Stored size: 661 Bytes
Contents
# -*- coding: utf-8 -*- module Redisable module Connection def self.conn(server) @pool ||= {} @pool[server] ||= begin conf = Redisable::Config.conf(server) redis = ::Redis.new(conf) raise "Redis server[#{conf["host"]}:#{conf["port"]}] is down!" unless reachable?(redis) redis end end def self.quit(server) redis = @pool[server] redis.quit if redis && reachable?(redis) @pool[server] = nil end def self.reset(server) quit(server) conn(server) end private def self.reachable?(redis) redis.ping == "PONG" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redisable-0.1.1 | lib/redisable/connection.rb |
redisable-0.1.0 | lib/redisable/connection.rb |
redisable-0.0.2 | lib/redisable/connection.rb |
redisable-0.0.1 | lib/redisable/connection.rb |