Skip to content

Commit

Permalink
feat: add NoCache config for driver
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jun 13, 2022
1 parent c525406 commit 6accc2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ type Config struct {
OnlyLocal bool
OnlyProxy bool
NoNeedSetLink bool
NoCache bool
}
3 changes: 3 additions & 0 deletions internal/operations/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6accc2e

Please sign in to comment.