class Fluent::EventRouter::MatchCache

def get(key)

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

def initialize

def initialize
  super
  @map = {}
  @keys = []
end