-
Notifications
You must be signed in to change notification settings - Fork 45.7k
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
[simple-cache-provider] Use LRU cache eviction #12851
Conversation
Max size is hard-coded to 500. In the future, we should make this configurable per resource.
a3df513
to
3e44bf7
Compare
Details of bundled changes.Comparing: 40ea053...3b51dba simple-cache-provider
Generated by 🚫 dangerJS |
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.
map: new Map(), | ||
head: null, | ||
tail: null, | ||
size: 0, |
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.
Rather than keeping and updating the 'size' property here, could we rely on the size
property of the map
attribute of the cache?
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.
Going to land this PR, we can fix these in a follow-up.
expect(IntegerStringResource.read(cache, 2)).toEqual('2'); | ||
expect(IntegerStringResource.read(cache, 3)).toEqual('3'); | ||
|
||
expect(() => IntegerStringResource.read(cache, 4)).toThrow(Promise); |
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.
Just one thing - I think even if 1, 2, and 3 are also evicted I think this will still pass. We could verify that those don't throw Promises?
Max size is hard-coded to 500. In the future, we should make this configurable per resource.