diff --git a/internal/op/fs.go b/internal/op/fs.go index e7e0e85f..94207d8b 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -58,8 +58,12 @@ func List(ctx context.Context, storage driver.Driver, path string, args model.Li if err != nil { return nil, errors.Wrapf(err, "failed to list objs") } - if !storage.Config().NoCache && len(files) > 0 { - listCache.Set(key, files, cache.WithEx[[]model.Obj](time.Minute*time.Duration(storage.GetStorage().CacheExpiration))) + if !storage.Config().NoCache { + 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 })