Skip to content

Is cache done by tag or by query & tag? #2938

Answered by phryneas
LoyalPotato asked this question in Q&A
Discussion options

You must be logged in to vote

Tags have no influence on cache entries. You can have 200 cache entries with completely different contents and the same tag. Tags are like labels you slap onto something to later say "invalidate everything with a red label".

Cache entries are a combination of endpoint name and the argument you put into it.

So useSomeQuery(3) would end up with a cache entry some(3) and useSomeQuery(5) would give you some(5). There is a little bit of sanitizing going on, so useSomeQuery({foo:1, bar:2}) will have the same cache entry as useSomeQuery({bar:2, foo:1}).

There is no consolidation of similar contents over multiple cache entries. RTK Query is a document cache and every cache entry is completely ind…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@LoyalPotato
Comment options

@phryneas
Comment options

@LoyalPotato
Comment options

Answer selected by LoyalPotato
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants