/** * Cache the HttpResponse object before being returned to caller. * The default implementation also invalidate the response object by marking it as valid so the * next request can detect if it has been invalidated. * Override this if you need to add additional processing to cache the response. * * @param request * @param fetchedResponse * @return HttpResponse object that has been updated with some metadata tags. */ protected HttpResponse cacheFetchedResponse(HttpRequest request, HttpResponse fetchedResponse) { if (!request.getIgnoreCache()) { // Mark the response with invalidation information prior to caching if (fetchedResponse.getCacheTtl() > 0) { fetchedResponse = invalidationService.markResponse(request, fetchedResponse); } HttpResponse cached = httpCache.addResponse(request, fetchedResponse); if (cached != null) { fetchedResponse = cached; // possibly modified response. } } return fetchedResponse; }
fetchedResponse = invalidationService.markResponse(request, fetchedResponse);
fetchedResponse = invalidationService.markResponse(request, fetchedResponse);