缩略图缓存加容量闸与删除联动清理

- Store 增 MaxBytes(默认 256MB):写入后节流扫描(10 分钟一次、同时只跑一个),
  超限按 mtime 从旧到新删到 3/4 水位(滞回,避免卡在边界反复删),顺带清掉
  进程被杀留下的 .tmp
- 命中缓存时 Touch 更新 mtime,淘汰因此是 LRU 而非「最早生成的先死」,
  热图不会被误删后反复回源拉存储
- 新增 Purge(sha):后台删除上传文件时连带清掉该图所有宽度的产物与 .failed
  标记,否则已删图片会永久占着缓存
This commit is contained in:
Sakurasan
2026-09-28 15:09:54 +08:00
parent 6108aca34c
commit 232abf2019
5 changed files with 193 additions and 4 deletions
+1
View File
@@ -82,6 +82,7 @@ func main() {
}
adminAPI := admin.NewAPI(st, cfg, adminSessions)
adminAPI.Blobs = blobs
adminAPI.Thumbs = thumbCache // 删文件时连带清掉它的缩略图
root := http.NewServeMux()
root.Handle("/api/admin/", adminAPI.Routes())