mirror of https://github.com/Xhofe/alist
feat: add `NoCache` config for driver
parent
c525406516
commit
6accc2eff6
|
@ -6,4 +6,5 @@ type Config struct {
|
||||||
OnlyLocal bool
|
OnlyLocal bool
|
||||||
OnlyProxy bool
|
OnlyProxy bool
|
||||||
NoNeedSetLink bool
|
NoNeedSetLink bool
|
||||||
|
NoCache bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@ var filesG singleflight.Group[[]driver.FileInfo]
|
||||||
|
|
||||||
// List files in storage, not contains virtual file
|
// List files in storage, not contains virtual file
|
||||||
func List(ctx context.Context, account driver.Driver, path string) ([]driver.FileInfo, error) {
|
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)
|
key := stdpath.Join(account.GetAccount().VirtualPath, path)
|
||||||
if files, ok := filesCache.Get(key); ok {
|
if files, ok := filesCache.Get(key); ok {
|
||||||
return files, nil
|
return files, nil
|
||||||
|
|
Loading…
Reference in New Issue