Sha256: ff742ac39ea6a07200486abf1465bf546a4bae73d58c3c04e4fc95ba9ef8a32d

Contents?: true

Size: 395 Bytes

Versions: 3

Compression:

Stored size: 395 Bytes

Contents

module Yodeler::Adapters
  class MemoryAdapter
    attr_reader :queue
    attr_accessor :max_queue_size

    def initialize
      @max_queue_size = 1000
      flush!
    end

    def flush!
      @queue = []
    end

    def dispatch(metric)
      @queue << metric
      @queue.shift if @queue.length > @max_queue_size
      metric
    end

    Yodeler.register_adapter(:memory, self)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yodeler-0.1.3 lib/yodeler/adapters/memory_adapter.rb
yodeler-0.1.2 lib/yodeler/adapters/memory_adapter.rb
yodeler-0.1.1 lib/yodeler/adapters/memory_adapter.rb