private List<File> filesThatCanBeDeleted(File[] files) {
        Instant deleteNotUsedSinceInstant = Instant.now().minus(durationToKeepFiles);

        Set<File> filesOnDisk = new HashSet<>(List.of(files));
        log.log(Level.FINE, () -> "Files on disk: " + filesOnDisk);
        int deleteCount = Math.max(0, filesOnDisk.size() - outDatedFilesToKeep);
        var canBeDeleted = filesOnDisk
                .stream()
                .peek(file -> log.log(Level.FINE, () -> file + ":" + fileLastModifiedTime(file.toPath())))
                .filter(fileReference -> isFileLastModifiedBefore(fileReference, deleteNotUsedSinceInstant))
                .sorted(Comparator.comparing(fileReference -> fileLastModifiedTime(fileReference.toPath())))
                .toList();

        // Make sure we keep some files
        canBeDeleted = canBeDeleted.subList(0, Math.min(canBeDeleted.size(), deleteCount));
        if (canBeDeleted.size() > 0)
            log.log(INFO, "Files that can be deleted (not accessed since " + deleteNotUsedSinceInstant +
                    ", will also keep " + outDatedFilesToKeep +
                    " no matter when last accessed): " + canBeDeleted);

        return canBeDeleted;
    }
Deletes file references and url downloads that have not been used for some time.
See {@link com.yahoo.vespa.config.proxy.filedistribution.RequestTracker} for how we track
when a file reference or download was last used.

@author hmusum
config-proxy/src/main/java/com/yahoo/vespa/config/proxy/filedistribution/FileReferencesAndDownloadsMaintainer.java