From dcac1aa3e33136d1c49d82f1ce9d101a6e097b98 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 25 Aug 2021 23:03:34 +0300 Subject: [PATCH] [#230] layer: Change objects_list_cache's key Remove access_key from objectsListCache key Signed-off-by: Angira Kekteeva --- api/layer/object.go | 2 +- api/layer/object_list_cache.go | 9 ++------- api/layer/versioning.go | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/api/layer/object.go b/api/layer/object.go index b18c12cd..92016bc2 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -572,7 +572,7 @@ func (n *layer) listAllObjects(ctx context.Context, p ListObjectsParamsCommon) ( return nil, err } - if cacheKey, err = createKey(ctx, bkt.CID, listObjectsMethod, p.Prefix, p.Delimiter); err != nil { + if cacheKey, err = createKey(bkt.CID, listObjectsMethod, p.Prefix, p.Delimiter); err != nil { return nil, err } diff --git a/api/layer/object_list_cache.go b/api/layer/object_list_cache.go index 18e562ce..16776d4e 100644 --- a/api/layer/object_list_cache.go +++ b/api/layer/object_list_cache.go @@ -1,7 +1,6 @@ package layer import ( - "context" "sync" "time" @@ -84,14 +83,10 @@ func (l *listObjectsCache) Put(key cacheOptions, objects []*ObjectInfo) { }) } -func createKey(ctx context.Context, cid *cid.ID, method, prefix, delimiter string) (cacheOptions, error) { - box, err := GetBoxData(ctx) - if err != nil { - return cacheOptions{}, err - } +func createKey(cid *cid.ID, method, prefix, delimiter string) (cacheOptions, error) { p := cacheOptions{ method: method, - key: box.Gate.AccessKey + cid.String(), + key: cid.String(), delimiter: delimiter, prefix: prefix, } diff --git a/api/layer/versioning.go b/api/layer/versioning.go index 20e5219a..fac34940 100644 --- a/api/layer/versioning.go +++ b/api/layer/versioning.go @@ -193,7 +193,7 @@ func (n *layer) ListObjectVersions(ctx context.Context, p *ListObjectVersionsPar return nil, err } - cacheKey, err := createKey(ctx, bkt.CID, listVersionsMethod, p.Prefix, p.Delimiter) + cacheKey, err := createKey(bkt.CID, listVersionsMethod, p.Prefix, p.Delimiter) if err != nil { return nil, err }