From 6cdd85283b0fcc396a474c4a8725c7faf586738c Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Tue, 14 Jun 2022 22:37:41 +0800 Subject: [PATCH] chore: reduce cache shards --- internal/operations/fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/operations/fs.go b/internal/operations/fs.go index 15794af9..5ecc7283 100644 --- a/internal/operations/fs.go +++ b/internal/operations/fs.go @@ -15,7 +15,7 @@ import ( // In order to facilitate adding some other things before and after file operations -var filesCache = cache.NewMemCache[[]driver.FileInfo]() +var filesCache = cache.NewMemCache(cache.WithShards[[]driver.FileInfo](64)) var filesG singleflight.Group[[]driver.FileInfo] // List files in storage, not contains virtual file @@ -72,7 +72,7 @@ func Get(ctx context.Context, account driver.Driver, path string) (driver.FileIn return nil, errors.WithStack(driver.ErrorObjectNotFound) } -var linkCache = cache.NewMemCache[*driver.Link]() +var linkCache = cache.NewMemCache(cache.WithShards[*driver.Link](16)) var linkG singleflight.Group[*driver.Link] // Link get link, if is an url. should have an expiry time