# File lib/puppet/indirector/indirection.rb, line 184
184:     def find(key, *args)
185:         request = request(:find, key, *args)
186:         terminus = prepare(request)
187: 
188:         begin
189:             if result = find_in_cache(request)
190:                 return result
191:             end
192:         rescue => detail
193:             puts detail.backtrace if Puppet[:trace]
194:             Puppet.err "Cached %s for %s failed: %s" % [self.name, request.key, detail]
195:         end
196: 
197:         # Otherwise, return the result from the terminus, caching if appropriate.
198:         if ! request.ignore_terminus? and result = terminus.find(request)
199:             result.expiration ||= self.expiration
200:             if cache? and request.use_cache?
201:                 Puppet.info "Caching %s for %s" % [self.name, request.key]
202:                 cache.save request(:save, result, *args)
203:             end
204: 
205:             return terminus.respond_to?(:filter) ? terminus.filter(result) : result
206:         end
207: 
208:         return nil
209:     end