Skip to content

Add cache invalidation or cache setting API #32

Open

Description

@cspotcode

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.

Activity

  1. changed the title [-]Add cache invalidation API[/-] [+]Add cache invalidation or cache setting API[/+] on Oct 17, 2021
  2. cspotcode commented on Oct 17, 2021

    @cspotcode
    OwnerAuthor

    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.

  3. cspotcode commented on Oct 17, 2021

    @cspotcode
    OwnerAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions