code: private static long parseCacheHeader(Map<String, String> headers) {
      if (headers.get("CACHE-CONTROL") != null) {
        String cacheControlHeader = headers.get("CACHE-CONTROL");
        Matcher m = CACHE_CONTROL_PATTERN.matcher(cacheControlHeader);
        if (m.matches()) {
          return new Date().getTime() + Long.parseLong(m.group(1)) * 1000L;
        }
      }
      if (headers.get("EXPIRES") != null) {
        try {
          return DATE_HEADER_FORMAT.parse(headers.get("EXPIRES")).getTime();
        } catch (ParseException e) {
        }
      }
      // No result, no expiry strategy
      return 0;
    }
docs: Parse both Cache-Control and Expires headers to determine if there is any caching strategy requested by service.
  
  @param headers the headers.
  @return 0 if no strategy, or the timestamp matching the future expiration in milliseconds otherwise.