Parent

Methods

Class/Module Index [+]

Quicksearch

Fluent::EventRouter::MatchCache

Constants

MATCH_CACHE_SIZE

Public Class Methods

new() click to toggle source
# File lib/fluent/event_router.rb, line 111
def initialize
  super
  @map = {}
  @keys = []
end

Public Instance Methods

get(key) click to toggle source
# File lib/fluent/event_router.rb, line 117
def get(key)
  if collector = @map[key]
    return collector
  end
  collector = @map[key] = yield
  if @keys.size >= MATCH_CACHE_SIZE
    # expire the oldest key
    @map.delete @keys.shift
  end
  @keys << key
  collector
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.