-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update: Add BoundedCache for Thumbnails Sidebar #917
Update: Add BoundedCache for Thumbnails Sidebar #917
Conversation
Verified that @ConradJChan has signed the CLA. Thanks for the pull request! |
constructor(maxEntries) { | ||
super(); | ||
|
||
this.maxEntries = maxEntries || 500; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 500?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is more specific to the application of Thumbnail images, but it's basically arbitrary. I figure if the images are ~50KB 500 would be 25MB of cache which seemed like an ok starting point
// If image is already in cache, then use it instead of waiting for | ||
// the second render image pass | ||
const cachedImage = this.thumbnailImageCache.get(itemIndex); | ||
if (cachedImage && !cachedImage.inProgress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't we still want to use it even if it's in progress again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if It's in progress, that means there is no generated image yet so there's nothing to insert into the DOM at this point. We add a cache entry with inProgress
as true to avoid multiple images being requested
No description provided.