Sha256: d03b69d3f86b65c8afd2bdd10ab961591898ecdbe61c7a0cf6a57a4eb42072f8

Contents?: true

Size: 538 Bytes

Versions: 5

Compression:

Stored size: 538 Bytes

Contents

require 'redis'
require 'redis-namespace'

module Attention
  # Provides a namespaced Redis connection
  module Connection
    # Creates a Redis connection
    # @return [Redis] A namespaced Redis connection with configuration
    #   from Attention.options
    def self.new
      connection = Redis.new url: Attention.options[:redis_url],
          connect_timeout: Attention.options[:timeout],
          timeout: Attention.options[:timeout]

      Redis::Namespace.new Attention.options[:namespace], redis: connection
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attention-0.0.6 lib/attention/connection.rb
attention-0.0.5 lib/attention/connection.rb
attention-0.0.4 lib/attention/connection.rb
attention-0.0.3 lib/attention/connection.rb
attention-0.0.2 lib/attention/connection.rb