Class CacheUpdateHandler


  • class CacheUpdateHandler
    extends java.lang.Object
    Creates new HttpCacheEntrys and updates existing ones with new or updated information based on the response from the origin server.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HttpCacheEntry createCacheEntry​(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, org.apache.hc.core5.util.ByteArrayBuffer content, java.time.Instant requestSent, java.time.Instant responseReceived)
      Creates a cache entry for the given request, origin response message and response content.
      private org.apache.hc.core5.http.Header[] mergeHeaders​(HttpCacheEntry entry, org.apache.hc.core5.http.HttpResponse response)  
      HttpCacheEntry updateCacheEntry​(java.lang.String requestId, HttpCacheEntry entry, java.time.Instant requestDate, java.time.Instant responseDate, org.apache.hc.core5.http.HttpResponse response)
      Update the entry with the new information from the response.
      HttpCacheEntry updateParentCacheEntry​(java.lang.String requestId, HttpCacheEntry existing, HttpCacheEntry entry, java.lang.String variantKey, java.lang.String variantCacheKey)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheUpdateHandler

        CacheUpdateHandler()
      • CacheUpdateHandler

        CacheUpdateHandler​(ResourceFactory resourceFactory)
    • Method Detail

      • createCacheEntry

        public HttpCacheEntry createCacheEntry​(org.apache.hc.core5.http.HttpRequest request,
                                               org.apache.hc.core5.http.HttpResponse originResponse,
                                               org.apache.hc.core5.util.ByteArrayBuffer content,
                                               java.time.Instant requestSent,
                                               java.time.Instant responseReceived)
                                        throws ResourceIOException
        Creates a cache entry for the given request, origin response message and response content.
        Throws:
        ResourceIOException
      • updateCacheEntry

        public HttpCacheEntry updateCacheEntry​(java.lang.String requestId,
                                               HttpCacheEntry entry,
                                               java.time.Instant requestDate,
                                               java.time.Instant responseDate,
                                               org.apache.hc.core5.http.HttpResponse response)
                                        throws ResourceIOException
        Update the entry with the new information from the response. Should only be used for 304 responses.
        Throws:
        ResourceIOException
      • mergeHeaders

        private org.apache.hc.core5.http.Header[] mergeHeaders​(HttpCacheEntry entry,
                                                               org.apache.hc.core5.http.HttpResponse response)