fix: cache is modified while sorting (close #2340)

This commit is contained in:
Noah Hsu
2022-11-15 14:38:23 +08:00
parent 3fbdf6f022
commit 4dcaa24758
2 changed files with 5 additions and 1 deletions

View File

@ -60,8 +60,10 @@ func List(ctx context.Context, storage driver.Driver, path string, args model.Li
}
if !storage.Config().NoCache {
if len(files) > 0 {
log.Debugf("set cache: %s => %+v", key, files)
listCache.Set(key, files, cache.WithEx[[]model.Obj](time.Minute*time.Duration(storage.GetStorage().CacheExpiration)))
} else {
log.Debugf("del cache: %s", key)
listCache.Del(key)
}
}