Sha256: 4598fc0fed1723555369b2dcd9e1f549a78bd4f42dc8b8b72f24471efd6f1c08
Contents?: true
Size: 570 Bytes
Versions: 2
Compression:
Stored size: 570 Bytes
Contents
require "metacrunch/redis" module Metacrunch class Redis::QueueWriter def initialize(redis_connection_or_url, queue_name, options = {}) @queue_name = queue_name raise ArgumentError, "queue_name must be a string" unless queue_name.is_a?(String) @redis = if redis_connection_or_url.is_a?(String) ::Redis.new(url: redis_connection_or_url) else redis_connection_or_url end end def write(data) @redis.rpush(@queue_name, data.to_json) end def close @redis.close if @redis end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
metacrunch-3.1.1 | lib/metacrunch/redis/queue_writer.rb |
metacrunch-3.1.0 | lib/metacrunch/redis/queue_writer.rb |