Class: Pakyow::Data::Subscribers::Adapters::Redis::Pipeliner Private
- Inherits:
-
Object
- Object
- Pakyow::Data::Subscribers::Adapters::Redis::Pipeliner
- Defined in:
- lib/pakyow/data/subscribers/adapters/redis/pipeliner.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- TIMEOUT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1.0 / 100.0
Class Method Summary collapse
- .pipeline(redis) ⇒ Object private
Instance Method Summary collapse
- #enqueue(future) ⇒ Object private
-
#initialize(redis) ⇒ Pipeliner
constructor
private
A new instance of Pipeliner.
- #wait ⇒ Object private
Constructor Details
#initialize(redis) ⇒ Pipeliner
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Pipeliner.
12 13 14 15 |
# File 'lib/pakyow/data/subscribers/adapters/redis/pipeliner.rb', line 12 def initialize(redis) @redis = redis @commands = [] end |
Class Method Details
.pipeline(redis) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 37 38 39 |
# File 'lib/pakyow/data/subscribers/adapters/redis/pipeliner.rb', line 31 def self.pipeline(redis) pipeliner = Pipeliner.new(redis) redis.pipelined do yield pipeliner end pipeliner.wait end |
Instance Method Details
#enqueue(future) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/pakyow/data/subscribers/adapters/redis/pipeliner.rb', line 17 def enqueue(future) @commands << { future: future, callback: Proc.new } end |
#wait ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 26 27 28 29 |
# File 'lib/pakyow/data/subscribers/adapters/redis/pipeliner.rb', line 21 def wait @commands.map { |command| while command[:future].value.is_a?(::Redis::FutureNotReady) sleep TIMEOUT end command[:callback].call(command[:future].value) } end |