mirror of https://github.com/Xhofe/alist
fix: delete cache if files is empty
parent
3e9c38697d
commit
0019959eec
|
@ -58,8 +58,12 @@ func List(ctx context.Context, storage driver.Driver, path string, args model.Li
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to list objs")
|
return nil, errors.Wrapf(err, "failed to list objs")
|
||||||
}
|
}
|
||||||
if !storage.Config().NoCache && len(files) > 0 {
|
if !storage.Config().NoCache {
|
||||||
listCache.Set(key, files, cache.WithEx[[]model.Obj](time.Minute*time.Duration(storage.GetStorage().CacheExpiration)))
|
if len(files) > 0 {
|
||||||
|
listCache.Set(key, files, cache.WithEx[[]model.Obj](time.Minute*time.Duration(storage.GetStorage().CacheExpiration)))
|
||||||
|
} else {
|
||||||
|
listCache.Del(key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return files, nil
|
return files, nil
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue