private Map tryReadCache()

in plugins/vault/src/main/java/co/elastic/gradle/vault/VaultExtension.java [160:181]


    private Map<String, String> tryReadCache(Path leaseExpiration, Path data) {
        if (Files.exists(leaseExpiration)) {
            try {
                final long expireMillis = Long.parseLong(Files.readString(leaseExpiration));
                if (isValidLease(expireMillis)) {
                    return Files.list(data).collect(Collectors.toMap(
                            path -> path.getFileName().toString(),
                            path -> {
                                try {
                                    return Files.readString(path);
                                } catch (IOException e) {
                                    throw new UncheckedIOException(e);
                                }
                            }
                    ));
                }
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }
        return null;
    }