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

Method today

ZezeJava/ZezeJava/src/main/java/Zeze/Util/Cache.java:118–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 }
117
118 private @NotNull FileOutputStream today() throws IOException {
119 var nowDays = System.currentTimeMillis() / (24 * 60 * 60 * 1000);
120 // 第一次执行时,如果nowDays等于0(即days的初始值),会返回null。
121 // 这种情况就不处理了。
122 if (todayDays != nowDays) {
123 lock();
124 try {
125 if (todayDays != nowDays) {
126 todayDays = nowDays;
127 if (todayFile != null)
128 todayFile.close();
129 todayFile = new FileOutputStream(Paths.get(name, "days_" + todayDays).toFile());
130 }
131 return todayFile;
132 } finally {
133 unlock();
134 }
135 }
136 return todayFile;
137 }
138
139 private void tryRemove() throws IOException, RocksDBException {
140 var prefix = "days_";

Callers 1

dbSaveMethod · 0.95

Calls 4

lockMethod · 0.65
closeMethod · 0.65
getMethod · 0.65
unlockMethod · 0.65

Tested by

no test coverage detected