Class Cache.InMemoryCacheBuilder

    • Method Detail

      • maxItems

        public Cache.InMemoryCacheBuilder maxItems​(int maxItems)
        The maximum number of cache entries. After reaching the limit the eldest entries will be evicted. Default is 8192.
        Parameters:
        maxItems - The maximum number of cache entries. Should be positive.
      • size

        public Cache.InMemoryCacheBuilder size​(long size)
        The amount of bytes allowed to be stored. Negative value means no memory restriction is made. Note that only response body bytes are counted.
      • requestFilter

        public Cache.InMemoryCacheBuilder requestFilter​(java.util.function.Predicate<java.net.http.HttpRequest> filter)
        Adds given predicate to predicated chain. The calls with requests that did not pass given predicate will not be subjected to caching facility. Semantically request filter is equivalent to Cache-Control: no-store header in request.
        Parameters:
        filter - The request filter.
      • responseFilter

        public Cache.InMemoryCacheBuilder responseFilter​(java.util.function.Predicate<java.net.http.HttpResponse.ResponseInfo> filter)
        Adds given predicate to predicated chain. The calls resulting with response that did not pass given predicate will not be subjected to caching facility. Semantically response filter is equivalent to Cache-Control: no-store header in response.
        Parameters:
        filter - The request filter.