[auth] Add RequestCache.clearForContext and export RequestCache class #1189
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.
If the scope initializer loads data that may change during a request for example due to a new user session or permission change then we need a way to clear the cache such that the scope initializer can be re-executed based on the new context state.
@hayes this contribution is based on our discord discussion: https://discord.com/channels/625400653321076807/868135255616417834/1227683491492135092
To be honest, I didn't fully grasp your message I'd probably also update... in terms of what you wanted to update. I will note that I ended up adding a new static method instead of a
clearCache()
instance method you were proposing as it seemed easier than to manually reset/reinitialize each of the instances internal caches. That said, I'm happy to update this PR as much as needed to get it to your liking.