Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not planning to merge this, just sharing code
@NicholasCouri - My other idea for fixing #4500, based on feedback in your original PR that exported
GarbageCollector
, is to refactorGarbageCollector
to a classMapWithExpiration
that extendsMap
and handles the expiration internally. This branch shows my quick implementation of it and usage in the ODSP cache code. If you update it to take a variety of expiration policies not just expiryMs then it should work forPromiseCache
as well.If this approach is appealing to you, probably best to shop it around and get buy-off from the team to add a utility like this in
common-utils
before doing more coding on it. But if folks agree, then you can write it properly (I'm sure I have bugs) and test it and then finally replace the twoGarbageCollector
s with it once it's in.