From 6accc2eff608927497e7da8decf99b80d11a2b3a Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Mon, 13 Jun 2022 21:15:58 +0800 Subject: [PATCH] feat: add `NoCache` config for driver --- internal/driver/config.go | 1 + internal/operations/fs.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/internal/driver/config.go b/internal/driver/config.go index 98e4b79b..30d8ffb3 100644 --- a/internal/driver/config.go +++ b/internal/driver/config.go @@ -6,4 +6,5 @@ type Config struct { OnlyLocal bool OnlyProxy bool NoNeedSetLink bool + NoCache bool } diff --git a/internal/operations/fs.go b/internal/operations/fs.go index f8d34b1b..15794af9 100644 --- a/internal/operations/fs.go +++ b/internal/operations/fs.go @@ -20,6 +20,9 @@ var filesG singleflight.Group[[]driver.FileInfo] // List files in storage, not contains virtual file func List(ctx context.Context, account driver.Driver, path string) ([]driver.FileInfo, error) { + if account.Config().NoCache { + return account.List(ctx, path) + } key := stdpath.Join(account.GetAccount().VirtualPath, path) if files, ok := filesCache.Get(key); ok { return files, nil