code: public static boolean hasCacheableHeaders(Headers headers) {
          if (headers.contains(VARY_ALL)) {
              return false;
          }
          if (headers.contains(CACHE_CONTROL)) {
              Optional<CacheControl> cc = headers.getCacheControl();
              if (OptionalUtils.exists(cc, (cc2 -> cc2.isNoCache() || cc2.isNoStore()))) {
                 return false; 
              }
          }
          if (headers.contains(PRAGMA)) {
              Optional<String> header = headers.getFirstHeaderValue(PRAGMA);
              if (OptionalUtils.exists(header, s -> s.contains(NO_CACHE_HEADER_VALUE))) {
                  return false;
              }
          }
          if (headers.contains(EXPIRES)) {
              Optional<LocalDateTime> expires = headers.getExpires();
              Optional<LocalDateTime> date = headers.getDate();
              if (!expires.isPresent() || !date.isPresent()) {
                  return false;
              }
              if (OptionalUtils.exists(expires, e -> e.isBefore(date.get())) || OptionalUtils.exists(expires, e -> e.isEqual(date.get()))) {
                  return false;
              }
          }
          return true;
      }
docs: From http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4.
  <p></p>
  Unless specifically constrained by a cache-control (section 14.9) directive,
  a caching system MAY always store a successful response (see section 13.8)
  as a cache entry, MAY return it without validation if it is fresh, and MAY return it
  after successful validation. If there is neither a cache validator nor an explicit
  expiration time associated with a response, we do not expect it to be cached,
  but certain caches MAY violate this expectation
  (for example, when little or no network connectivity is available).
  A client can usually detect that such a response was taken from a cache by comparing
  the Date header to the current time.
  
  @param headers the headers to analyze
  @return {@code true} if the headers were cacheable, {@code false} if not.