T
TanStack10mo ago
other-emerald

Garbage collection for queries with searches

Assuming i have a query that accepts a search parameter, if a user searches, every inactive query will be cached and then only be cleared after 5 minutes. If a user keeps searching it'll add a lot of entries into the cache as they will all have a different query key, is this less of an issue than i think it is? I'm mostly just worried users will run out of memory if they overdo searching
2 Replies
quickest-silver
quickest-silver10mo ago
Unless you're caching massive amounts of data it sounds like you're worrying preemptively I'm not confident but I think Chrome limits a single page to around 1.4GB You could always set a lower gcTime if you see issues. Perhaps 60 seconds instead?
other-emerald
other-emeraldOP10mo ago
I think that's valid 👍

Did you find this page helpful?