module Slanger::Redis

Private Instance Methods

new_connection() click to toggle source
# File lib/slanger/redis.rb, line 35
def new_connection
  EM::Hiredis.connect Slanger::Config.redis_address
end
publisher() click to toggle source
# File lib/slanger/redis.rb, line 21
def publisher
  @publisher ||= new_connection
end
regular_connection() click to toggle source
# File lib/slanger/redis.rb, line 17
def regular_connection
  @regular_connection ||= new_connection
end
subscriber() click to toggle source
# File lib/slanger/redis.rb, line 25
def subscriber
  @subscriber ||= new_connection.pubsub.tap do |c|
    c.on(:message) do |channel, message|
      message = Oj.strict_load(message)
      c = Channel.from message['channel']
      c.dispatch message, channel
    end
  end
end