Skip to content

Commit

Permalink
fix: cache key collision
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Feb 5, 2021
1 parent 8a2fe3d commit e40af44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/categories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@ Categories.getChildrenCids = async function (rootCid) {
await recursive(keys);
}
const key = 'cid:' + rootCid + ':children';
const childrenCids = cache.get(key);
const cacheKey = 'cache:' + key;
const childrenCids = cache.get(cacheKey);
if (childrenCids) {
return childrenCids.slice();
}

await recursive(key);
allCids = _.uniq(allCids);
cache.set(key, allCids);
cache.set(cacheKey, allCids);
return allCids.slice();
};

Expand Down

0 comments on commit e40af44

Please sign in to comment.