Sha256: eef8338b9db60fec18465eb23e9fb5548f9cbf473ec93a539c2aa6bd8cea4289

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

require_relative 'redis'
require_relative 'lazy_evaluated_pool'

class RedisLazyEvaluatedPool < LazyEvaluatedPool
  CONFIG_DEFAULTS = {
      url: 'redis://localhost:6379/0',
      size: 10
  }
  private
  def self.connection
    Proc.new { |config|
      config = RedisLazyEvaluatedPool::CONFIG_DEFAULTS.merge (config|| {}).deep_symbolize_keys
      connection = EventMachine::Hiredis.connect(config[:url])
      connection = Redis::Namespace.new(config[:namespace], redis: connection) if config[:namespace]
      connection
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-gen-0.0.6 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb