Sha256: 3f9d58ac4818ae057dca46e554f1677b75daedc7180be870404e19477cdfaf8f

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

require 'redis-namespace'
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 = 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

5 entries across 5 versions & 1 rubygems

Version Path
grape-gen-0.0.5 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb
grape-gen-0.0.4 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb
grape-gen-0.0.3 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb
grape-gen-0.0.2 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb
grape-gen-0.0.1 template/config/initializers/em-patches/redis_lazy_evaluated_pool.rb