feat: clear cache after change

This commit is contained in:
Noah Hsu
2022-06-30 22:51:49 +08:00
parent 2b1726614b
commit 53416172e7
5 changed files with 31 additions and 3 deletions

View File

@ -22,6 +22,11 @@ import (
var filesCache = cache.NewMemCache(cache.WithShards[[]model.Obj](64))
var filesG singleflight.Group[[]model.Obj]
func ClearCache(account driver.Driver, path string) {
key := stdpath.Join(account.GetAccount().VirtualPath, path)
filesCache.Del(key)
}
// List files in storage, not contains virtual file
func List(ctx context.Context, account driver.Driver, path string, refresh ...bool) ([]model.Obj, error) {
path = utils.StandardizePath(path)