文件缓存增加自动限速/提升本地缓存数据库写入和查询速度

This commit is contained in:
GoEdgeLab
2022-04-20 18:23:26 +08:00
parent c8b8071bee
commit f39c59569a
7 changed files with 147 additions and 33 deletions

View File

@@ -127,8 +127,8 @@ func (this *FileWriter) Close() error {
err = this.rawWriter.Close()
if err != nil {
_ = os.Remove(path)
} else {
err = os.Rename(path, strings.Replace(path, ".tmp", "", 1))
} else if strings.HasSuffix(path, FileTmpSuffix) {
err = os.Rename(path, strings.Replace(path, FileTmpSuffix, "", 1))
if err != nil {
_ = os.Remove(path)
}