docs: private static boolean staleCacheFile(final HttpQuery query,
                                          final long end_time,
                                          final long max_age,
                                          final File cachedfile) {
      final long mtime = cachedfile.lastModified() / 1000;
      if (mtime <= 0) {
        return true;  // File doesn't exist, or can't be read.
      }
  
      final long now = System.currentTimeMillis() / 1000;
      // How old is the cached file, in seconds?
      final long staleness = now - mtime;
      if (staleness < 0) {  // Can happen if the mtime is "in the future".
        logWarn(query, "Not using file @ " + cachedfile + " with weird"
                + " mtime in the future: " + mtime);
        return true;  // Play it safe, pretend we can't use this file.
      }
  
      // Case 1: The end time is an absolute point in the past.
      // We might be able to re-use the cached file.
      if (0 < end_time && end_time < now) {
        // If the file was created prior to the end time, maybe we first
        // executed this query while the result was uncacheable.  We can
        // tell by looking at the mtime on the file.  If the file was created
        // before the query end time, then it contains partial results that
        // shouldn't be served again.
        return mtime < end_time;
      }
  
      // Case 2: The end time of the query is now or in the future.
      // The cached file contains partial data and can only be re-used if it's
      // not too old.
      if (staleness > max_age) {
        logInfo(query, "Cached file @ " + cachedfile.getPath() + " is "
                + staleness + "s stale, which is more than its limit of "
                + max_age + "s, and needs to be regenerated.");
        return true;
      }
      return false;
    }