Class: Karafka::Web::Tracking::TtlHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/karafka/web/tracking/ttl_hash.rb

Overview

Hash that accumulates data that has an expiration date (ttl) Used to keep track of metrics in a window

Instance Method Summary collapse

Constructor Details

#initialize(ttl) ⇒ TtlHash

Returns a new instance of TtlHash.

Parameters:

  • ttl (Integer)

    milliseconds ttl



10
11
12
# File 'lib/karafka/web/tracking/ttl_hash.rb', line 10

def initialize(ttl)
  super() { |k, v| k[v] = TtlArray.new(ttl) }
end