Method: Puppet::Indirector::Indirection#find_in_cache

Defined in:
lib/puppet/indirector/indirection.rb

#find_in_cache(request) ⇒ Object



235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/puppet/indirector/indirection.rb', line 235

def find_in_cache(request)
  # See if our instance is in the cache and up to date.
  return nil unless cache? and ! request.ignore_cache? and cached = cache.find(request)
  if cached.expired?
    Puppet.info _("Not using expired %{indirection} for %{request} from cache; expired at %{expiration}") % { indirection: self.name, request: request.key, expiration: cached.expiration }
    return nil
  end

  Puppet.debug "Using cached #{self.name} for #{request.key}"
  cached
rescue => detail
  Puppet.log_exception(detail, _("Cached %{indirection} for %{request} failed: %{detail}") % { indirection: self.name, request: request.key, detail: detail })
  nil
end