Method: Datadog::Tracing::Contrib::Configuration::CachingResolver#resolve

Defined in:
lib/datadog/tracing/contrib/configuration/resolver.rb

#resolve(value) ⇒ Object

Matches an arbitrary value against the configured matchers previously set with ‘#add`.

If multiple matchers would match, returns the latest one.

Parameters:

  • value (Object)

    integration-specific value

Returns:

  • (Object)

    matching ‘value` configured at `#add`, or `nil` if none match



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/datadog/tracing/contrib/configuration/resolver.rb', line 102

def resolve(value)
  if @cache.key?(value)
    @cache[value]
  else
    if @cache.size >= @cache_limit
      @cache.shift # Remove the oldest entry if cache is full
    end

    @cache[value] = super
  end
end