aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java35
1 files changed, 0 insertions, 35 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java
deleted file mode 100644
index 0a081ac53b4..00000000000
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCache.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.node.admin.task.util.file;
-
-import java.time.Instant;
-import java.util.Optional;
-
-/**
- * Class to avoid repeated reads of file content when the file seldom changes.
- *
- * @author hakonhall
- */
-class FileContentCache {
- private final UnixPath path;
-
- private Optional<byte[]> value = Optional.empty();
- private Optional<Instant> modifiedTime = Optional.empty();
-
- FileContentCache(UnixPath path) {
- this.path = path;
- }
-
- byte[] get(Instant lastModifiedTime) {
- if (modifiedTime.isEmpty() || lastModifiedTime.isAfter(modifiedTime.get())) {
- value = Optional.of(path.readBytes());
- modifiedTime = Optional.of(lastModifiedTime);
- }
-
- return value.get();
- }
-
- void updateWith(byte[] content, Instant modifiedTime) {
- this.value = Optional.of(content);
- this.modifiedTime = Optional.of(modifiedTime);
- }
-}