From 6dd8102a8272006dea543a7bf3b3dddcac4be388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=87=89?= <927625802@qq.com> Date: Tue, 11 Jan 2022 23:45:12 +0800 Subject: [PATCH] :fire: Optimize delete cache --- server/controllers/file/delete.go | 4 +++- server/controllers/file/upload.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/controllers/file/delete.go b/server/controllers/file/delete.go index 0eb0012f..cdbd36d0 100644 --- a/server/controllers/file/delete.go +++ b/server/controllers/file/delete.go @@ -36,7 +36,9 @@ func DeleteFiles(c *gin.Context) { } err = operate.Delete(driver, account, path_, clearCache) if err != nil { - _ = base.DeleteCache(utils.Dir(path_), account) + if i == 0 { + _ = base.DeleteCache(utils.Dir(path_), account) + } common.ErrorResp(c, err, 500) return } diff --git a/server/controllers/file/upload.go b/server/controllers/file/upload.go index 84a54bb4..3983f4b1 100644 --- a/server/controllers/file/upload.go +++ b/server/controllers/file/upload.go @@ -55,7 +55,9 @@ func UploadFiles(c *gin.Context) { } err = operate.Upload(driver, account, &fileStream, clearCache) if err != nil { - _ = base.DeleteCache(path_, account) + if i != 0 { + _ = base.DeleteCache(path_, account) + } common.ErrorResp(c, err, 500) return }