Class: Pakyow::Realtime::Server::Adapters::Redis::Buffer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pakyow/realtime/server/adapters/redis.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

PUBLISH_BUFFER_SIZE =

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.

The number of publish commands to pipeline to redis.

1_000
PUBLISH_BUFFER_FLUSH_MS =

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.

How often the publish buffer should be flushed.

150

Instance Method Summary collapse

Constructor Details

#initialize(redis, channel) ⇒ Buffer

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 Buffer.



205
206
207
208
# File 'lib/pakyow/realtime/server/adapters/redis.rb', line 205

def initialize(redis, channel)
  @redis, @channel = redis, channel
  @buffer = Concurrent::Array.new
end

Instance Method Details

#<<(payload) ⇒ 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.



210
211
212
213
# File 'lib/pakyow/realtime/server/adapters/redis.rb', line 210

def <<(payload)
  @buffer << payload
  maybe_flush
end