Class CacheInvalidator

  • All Implemented Interfaces:
    HttpCacheInvalidator

    @Contract(threading=IMMUTABLE_CONDITIONAL)
    class CacheInvalidator
    extends java.lang.Object
    implements HttpCacheInvalidator
    Given a particular HttpRequest, flush any cache entries that this request would invalidate.
    Since:
    4.1
    • Field Detail

      • log

        private final org.apache.commons.logging.Log log
    • Method Detail

      • flushInvalidatedCacheEntries

        public void flushInvalidatedCacheEntries​(org.apache.http.HttpHost host,
                                                 org.apache.http.HttpRequest req)
        Remove cache entries from the cache that are no longer fresh or have been invalidated in some way.
        Specified by:
        flushInvalidatedCacheEntries in interface HttpCacheInvalidator
        Parameters:
        host - The backend host we are talking to
        req - The HttpRequest to that host
      • shouldInvalidateHeadCacheEntry

        private boolean shouldInvalidateHeadCacheEntry​(org.apache.http.HttpRequest req,
                                                       HttpCacheEntry parentCacheEntry)
      • requestIsGet

        private boolean requestIsGet​(org.apache.http.HttpRequest req)
      • isAHeadCacheEntry

        private boolean isAHeadCacheEntry​(HttpCacheEntry parentCacheEntry)
      • flushEntry

        private void flushEntry​(java.lang.String uri)
      • getEntry

        private HttpCacheEntry getEntry​(java.lang.String theUri)
      • flushUriIfSameHost

        protected void flushUriIfSameHost​(java.net.URL requestURL,
                                          java.net.URL targetURL)
      • flushRelativeUriFromSameHost

        protected void flushRelativeUriFromSameHost​(java.net.URL reqURL,
                                                    java.lang.String relUri)
      • flushAbsoluteUriFromSameHost

        protected boolean flushAbsoluteUriFromSameHost​(java.net.URL reqURL,
                                                       java.lang.String uri)
      • getAbsoluteURL

        private java.net.URL getAbsoluteURL​(java.lang.String uri)
      • getRelativeURL

        private java.net.URL getRelativeURL​(java.net.URL reqURL,
                                            java.lang.String relUri)
      • requestShouldNotBeCached

        protected boolean requestShouldNotBeCached​(org.apache.http.HttpRequest req)
      • notGetOrHeadRequest

        private boolean notGetOrHeadRequest​(java.lang.String method)
      • flushInvalidatedCacheEntries

        public void flushInvalidatedCacheEntries​(org.apache.http.HttpHost host,
                                                 org.apache.http.HttpRequest request,
                                                 org.apache.http.HttpResponse response)
        Flushes entries that were invalidated by the given response received for the given host/request pair.
        Specified by:
        flushInvalidatedCacheEntries in interface HttpCacheInvalidator
      • flushLocationCacheEntry

        private void flushLocationCacheEntry​(java.net.URL reqURL,
                                             org.apache.http.HttpResponse response,
                                             java.net.URL location)
      • getContentLocationURL

        private java.net.URL getContentLocationURL​(java.net.URL reqURL,
                                                   org.apache.http.HttpResponse response)
      • getLocationURL

        private java.net.URL getLocationURL​(java.net.URL reqURL,
                                            org.apache.http.HttpResponse response)
      • responseAndEntryEtagsDiffer

        private boolean responseAndEntryEtagsDiffer​(org.apache.http.HttpResponse response,
                                                    HttpCacheEntry entry)
      • responseDateOlderThanEntryDate

        private boolean responseDateOlderThanEntryDate​(org.apache.http.HttpResponse response,
                                                       HttpCacheEntry entry)