Sha256: fc95b7b16b02117eb09055c623b2de6add64aea3e3ec252eac6ce8b23a0132c2
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module QPush module Base KEY = 'qpush:v1'.freeze SUB_KEYS = [:delay, :queue, :perform, :stats, :heart, :crons, :history, :morgue].freeze module RedisHelper def self.included(base) base.extend(ClassMethods) end module ClassMethods def redis redis_pool.with do |conn| yield conn end end def redis_pool @redis_pool ||= build_pool(config.redis_pool, config.redis_url) end def build_pool(pool, url) ConnectionPool.new(size: pool) do Redis.new(url: url) end end def build_keys(namespace, priorities) name = "#{QPush::Base::KEY}:#{namespace}" keys = Hash[QPush::Base::SUB_KEYS.collect { |key| [key, "#{name}:#{key}"] }] keys[:perform_list] = (1..priorities).collect { |num| "#{keys[:perform]}:#{num}" } keys end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.10 | lib/qpush/base/redis.rb |