fix(alias): Support forced refresh of file list (#6562)

This commit is contained in:
j2rong4cn
2024-06-16 16:59:10 +08:00
committed by GitHub
parent fcf2683112
commit 29fe49fb87
5 changed files with 27 additions and 24 deletions

View File

@ -100,14 +100,14 @@ func Key(storage driver.Driver, path string) string {
}
// List files in storage, not contains virtual file
func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs, refresh ...bool) ([]model.Obj, error) {
func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs) ([]model.Obj, error) {
if storage.Config().CheckStatus && storage.GetStorage().Status != WORK {
return nil, errors.Errorf("storage not init: %s", storage.GetStorage().Status)
}
path = utils.FixAndCleanPath(path)
log.Debugf("op.List %s", path)
key := Key(storage, path)
if !utils.IsBool(refresh...) {
if !args.Refresh {
if files, ok := listCache.Get(key); ok {
log.Debugf("use cache when list %s", path)
return files, nil