Class BasicHttpCache

  • All Implemented Interfaces:
    HttpCache

    class BasicHttpCache
    extends java.lang.Object
    implements HttpCache
    • Method Detail

      • generateKey

        public java.lang.String generateKey​(org.apache.hc.core5.http.HttpHost host,
                                            org.apache.hc.core5.http.HttpRequest request,
                                            HttpCacheEntry cacheEntry)
        Specified by:
        generateKey in interface HttpCache
      • flushCacheEntriesFor

        public void flushCacheEntriesFor​(org.apache.hc.core5.http.HttpHost host,
                                         org.apache.hc.core5.http.HttpRequest request)
        Description copied from interface: HttpCache
        Clear all matching HttpCacheEntrys.
        Specified by:
        flushCacheEntriesFor in interface HttpCache
      • flushCacheEntriesInvalidatedByRequest

        public void flushCacheEntriesInvalidatedByRequest​(org.apache.hc.core5.http.HttpHost host,
                                                          org.apache.hc.core5.http.HttpRequest request)
        Description copied from interface: HttpCache
        Flush HttpCacheEntrys invalidated by the given request
        Specified by:
        flushCacheEntriesInvalidatedByRequest in interface HttpCache
      • flushCacheEntriesInvalidatedByExchange

        public void flushCacheEntriesInvalidatedByExchange​(org.apache.hc.core5.http.HttpHost host,
                                                           org.apache.hc.core5.http.HttpRequest request,
                                                           org.apache.hc.core5.http.HttpResponse response)
        Description copied from interface: HttpCache
        Flush HttpCacheEntrys invalidated by the given message exchange.
        Specified by:
        flushCacheEntriesInvalidatedByExchange in interface HttpCache
      • storeInCache

        void storeInCache​(java.lang.String cacheKey,
                          org.apache.hc.core5.http.HttpHost host,
                          org.apache.hc.core5.http.HttpRequest request,
                          HttpCacheEntry entry)
      • storeEntry

        void storeEntry​(java.lang.String cacheKey,
                        HttpCacheEntry entry)
      • storeVariantEntry

        void storeVariantEntry​(java.lang.String cacheKey,
                               org.apache.hc.core5.http.HttpHost host,
                               org.apache.hc.core5.http.HttpRequest req,
                               HttpCacheEntry entry)
      • reuseVariantEntryFor

        public void reuseVariantEntryFor​(org.apache.hc.core5.http.HttpHost host,
                                         org.apache.hc.core5.http.HttpRequest request,
                                         Variant variant)
        Description copied from interface: HttpCache
        Specifies cache should reuse the given cached variant to satisfy requests whose varying headers match those of the given client request.
        Specified by:
        reuseVariantEntryFor in interface HttpCache
      • updateCacheEntry

        public HttpCacheEntry updateCacheEntry​(org.apache.hc.core5.http.HttpHost host,
                                               org.apache.hc.core5.http.HttpRequest request,
                                               HttpCacheEntry stale,
                                               org.apache.hc.core5.http.HttpResponse originResponse,
                                               java.time.Instant requestSent,
                                               java.time.Instant responseReceived)
        Description copied from interface: HttpCache
        Update a HttpCacheEntry using a 304 HttpResponse.
        Specified by:
        updateCacheEntry in interface HttpCache
      • updateVariantCacheEntry

        public HttpCacheEntry updateVariantCacheEntry​(org.apache.hc.core5.http.HttpHost host,
                                                      org.apache.hc.core5.http.HttpRequest request,
                                                      org.apache.hc.core5.http.HttpResponse originResponse,
                                                      Variant variant,
                                                      java.time.Instant requestSent,
                                                      java.time.Instant responseReceived)
        Description copied from interface: HttpCache
        Update a specific HttpCacheEntry representing a cached variant using a 304 HttpResponse.
        Specified by:
        updateVariantCacheEntry in interface HttpCache
      • createCacheEntry

        public HttpCacheEntry createCacheEntry​(org.apache.hc.core5.http.HttpHost host,
                                               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)
        Description copied from interface: HttpCache
        Store a HttpResponse in the cache if possible, and return
        Specified by:
        createCacheEntry in interface HttpCache
      • getCacheEntry

        public HttpCacheEntry getCacheEntry​(org.apache.hc.core5.http.HttpHost host,
                                            org.apache.hc.core5.http.HttpRequest request)
        Description copied from interface: HttpCache
        Retrieve matching HttpCacheEntry from the cache if it exists.
        Specified by:
        getCacheEntry in interface HttpCache
      • getVariantCacheEntriesWithEtags

        public java.util.Map<java.lang.String,​Variant> getVariantCacheEntriesWithEtags​(org.apache.hc.core5.http.HttpHost host,
                                                                                             org.apache.hc.core5.http.HttpRequest request)
        Description copied from interface: HttpCache
        Retrieve all variants from the cache, if there are no variants then an empty Map is returned
        Specified by:
        getVariantCacheEntriesWithEtags in interface HttpCache