Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

option to disable chunk cache

Chris Lu316e853e0e7f
diff --git a/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java b/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
index e249d45249..df069503be 100644
--- a/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
+++ b/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
@@ -10,6 +10,9 @@ public class ChunkCache {
private final Cache<String, byte[]> cache;
public ChunkCache(int maxEntries) {
+ if (maxEntries == 0) {
+ return;
+ }
this.cache = CacheBuilder.newBuilder()
.maximumSize(maxEntries)
.expireAfterAccess(1, TimeUnit.HOURS)
@@ -17,10 +20,16 @@ public class ChunkCache {
}
public byte[] getChunk(String fileId) {
+ if (this.cache == null) {
+ return;
+ }
return this.cache.getIfPresent(fileId);
}
public void setChunk(String fileId, byte[] data) {
+ if (this.cache == null) {
+ return;
+ }
this.cache.put(fileId, data);
}