MCPcopy Create free account
hub / github.com/e2wugui/zeze / dbSave

Method dbSave

ZezeJava/ZezeJava/src/main/java/Zeze/Util/Cache.java:102–116  ·  view source on GitHub ↗
(@NotNull CacheObject value)

Source from the content-addressed store, hash-verified

100 }
101
102 private void dbSave(@NotNull CacheObject value) throws RocksDBException, IOException {
103 var id = value.cacheId();
104 if (id.isEmpty())
105 throw new IllegalArgumentException();
106
107 var bb = ByteBuffer.Allocate();
108 bb.WriteString(value.cacheId());
109 value.encode(bb);
110
111 var key = ByteBuffer.Allocate(128);
112 key.WriteString(id);
113 db.put(RocksDatabase.getDefaultWriteOptions(), key.Bytes, 0, key.WriteIndex, bb.Bytes, 0, bb.WriteIndex);
114
115 today().write((id + "\n").getBytes(StandardCharsets.UTF_8));
116 }
117
118 private @NotNull FileOutputStream today() throws IOException {
119 var nowDays = System.currentTimeMillis() / (24 * 60 * 60 * 1000);

Callers 1

getMethod · 0.95

Calls 10

AllocateMethod · 0.95
todayMethod · 0.95
cacheIdMethod · 0.65
isEmptyMethod · 0.65
encodeMethod · 0.65
putMethod · 0.65
writeMethod · 0.65
getBytesMethod · 0.65
WriteStringMethod · 0.45

Tested by

no test coverage detected