Skip to content

Add a possibility to delete all reselect selectors stored in the cache under a specific key pattern #40

@nym21

Description

@nym21

Hi,

I have a problem with the way we can remove selectors from a cache object.

For example, in my code, the keys under which my selectors are stored, are generated using a function and are following a specific pattern (number(:number)*). I would like to remove from the cache every selector stored under a key starting with a "1".
The problem is, that I cannot use selector.getMatchingSelector because it uses the resolver instead of directly checking if _cache has a selector stored under a specific string.

I found a way to counter that by adding this function to the createCachedSelector function:

selector.getCache = () => {
      return cache._cache;
};

and by removing manually in my code every selector stored under a key starting with a "1".
But it would be much cleaner if something similar was implemented directly in your cache objects.

So my question is the next, would it be possible to add a function which removes all the selectors of a cache object that are stored under a specific key pattern ?
If not, could you at least add a function to createCachedSelector which allows us to get the _cache of a cache object (like the one I had to add).

Feel free to let me know, if I'm not being clear enough !

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