class CacheHandler {

    final Logger log = getLogger(lookup().lookupClass());

    private Config config;

    public CacheHandler(Config config) {
        this.config = config;
    }

    public List<File> filterCacheBy(List<File> input, String key,
            boolean isVersion) {
        String pathSeparator = isVersion ? separator : "";
        List<File> output = new ArrayList<>(input);

        if (!key.isEmpty() && !input.isEmpty()) {
            output = input.stream()
                    .filter(file -> file.toString().toLowerCase(ROOT)
                            .contains(pathSeparator + key.toLowerCase(ROOT)))
                    .collect(toList());
        }
        log.trace("Filter cache by {} -- input list {} -- output list {} ", key,
                input, output);
        return output;
    }

    public List<File> getFilesInCache() {<FILL_FUNCTION_BODY>}

    public Optional<String> getDriverFromCache(String driverVersion,
            String driverName, DriverManagerType driverManagerType,
            Architecture arch, String os) {
        log.trace("Checking if {} exists in cache", driverName);
        List<File> filesInCache = getFilesInCache();
        if (!filesInCache.isEmpty()) {
            // Filter by name
            filesInCache = filterCacheBy(filesInCache, driverName, false);

            // Filter by version
            filesInCache = filterCacheBy(filesInCache, driverVersion, true);

            // Filter by OS
            filesInCache = filterCacheBy(filesInCache, os, false);

            // Filter by ARM64 architecture
            filesInCache = config.getArchitecture().filterArm64(filesInCache);

            if (filesInCache.size() == 1 && config.getArchitecture() != ARM64) {
                return Optional.of(filesInCache.get(0).toString());
            }

            // Filter by arch
            if (os.equalsIgnoreCase("win") && (driverManagerType == CHROME
                    || driverManagerType == CHROMIUM)) {
                log.trace(
                        "Avoid filtering for architecture {} with {} in Windows",
                        arch, driverName);
            } else {
                filesInCache = filterCacheBy(filesInCache, arch.toString(),
                        false);
            }

            if (!filesInCache.isEmpty()) {
                return Optional.of(
                        filesInCache.get(filesInCache.size() - 1).toString());
            }
        }

        log.trace("{} not found in cache", driverName);
        return Optional.empty();
    }

}

        List<File> listFiles = (List<File>) listFiles(config.getCacheFolder(),
                null, true);
        sort(listFiles);
        return listFiles;
    
<no_super_class>