Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Conversation

achingbrain
Copy link
Member

We 'preload' most CIDs we interact with on the network. In some cases
this can mean preloading the same CID over and over again which is not
necessary.

This PR adds a LRU cache to the preloader with a default size of 1000.
The cache is used to avoid re-preloading the same CID over and over again
until it drops out of the cache. We use a cache that will evict CIDs
over time to have some sort of upper bound on memory usage.

Fixes #3307

We 'preload' most CIDs we interact with on the network. In some cases
this can mean preloading the same CID over and over again which is not
necessary.

This PR adds a LRU cache to the preloader with a default size of 1000.
The cache is used to avoid re-preloading the same CID over and over again
until it drops out of the cache.  We use a cache that will evict CIDs
over time to have some sort of upper bound on memory usage.

Fixes #3307
@achingbrain achingbrain force-pushed the fix/cache-preloaded-cids branch from bd9686d to a190cdf Compare October 30, 2020 10:52
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Left some suggestions for jsdoc default values

Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
@achingbrain achingbrain merged commit b5ea76a into master Oct 30, 2020
@achingbrain achingbrain deleted the fix/cache-preloaded-cids branch October 30, 2020 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ipfs.cat calls https://node{0..3}.preload.ipfs.io/api/v0/refs?r=true&arg=<hash> on every cat

2 participants