Skip to content
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

Add cache invalidation or cache setting API #32

Open
cspotcode opened this issue Oct 11, 2021 · 2 comments
Open

Add cache invalidation or cache setting API #32

cspotcode opened this issue Oct 11, 2021 · 2 comments

Comments

@cspotcode
Copy link
Owner

Today the only option is to wipe the cache fully for each operation. Instead, we can expose an API to invalidate individual items in the cache.

@cspotcode cspotcode changed the title Add cache invalidation API Add cache invalidation or cache setting API Oct 17, 2021
@cspotcode
Copy link
Owner Author

cspotcode commented Oct 17, 2021

Thought about this some more. Might make sense to expose an API for setting cache entries. Every time we need to invalidate a cache entry, it is because we have a new value for it. Maybe just set that new value into the cache.

This mimics the functionality of hookRequire without necessitating a hook.

On the other hand, hookRequire saves fs calls by storing every loaded module into the cache.

@cspotcode
Copy link
Owner Author

If a consumer uses emptyCacheBetweenOperations then they should still take care to implement retrieveSourceMap. Even then, new SourceMapConsumer() is called every time, and I'm not sure of the performance implications.

This is why I'm averse to emptyCacheBetweenOperations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant