feat: cache manager and webapp manifest repository

This commit is contained in:
2026-08-16 16:23:48 +08:00
parent 0153ec38ae
commit f3405e003f
4 changed files with 138 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package top.yeij.hearth.cache
import java.io.File
// 文件缓存:以 key 为文件名,内容以 UTF-8 纯文本落盘
// File cache: uses key as filename, content stored as UTF-8 plain text
class CacheManager(private val baseDir: File) {
init { baseDir.mkdirs() }
fun save(key: String, content: String) {
File(baseDir, key).writeText(content)
}
fun load(key: String): String? {
val f = File(baseDir, key)
return if (f.exists()) f.readText() else null
}
}