Sha256: c172cb447a597c654c9b8678a9d3ef637799e09e5d87a7f89c81750cb0ef40b1

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

module Waffle
  module Transports
    class Redis < Base
      attr_reader :db

      protected
      def publish_impl(flow = 'events', message = '')
        db.publish(flow, encoder.encode(message))
      end

      def subscribe_impl(flow = 'events')
        db.subscribe(*flow) do |on|
          on.message do |channel, message|
            yield(channel, encoder.decode(message))
          end
        end
      end

      def connection_exceptions
        [Errno::ECONNREFUSED, Errno::ECONNRESET]
      end

      def do_connect
        @db = ::Redis.new(:url => config.url)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
waffle-0.6.0 lib/waffle/transports/redis.rb
waffle-0.5.1 lib/waffle/transports/redis.rb
waffle-0.5.0 lib/waffle/transports/redis.rb