From 8f1224ec1fe9ec2688c7e1c88ee8c078d236249b Mon Sep 17 00:00:00 2001 From: Clayton Marshall Date: Wed, 26 Aug 2020 16:39:39 -0400 Subject: [PATCH] added more detailed explanation of what the cache timeout does in the detailed walkthough of useQuery --- docs/src/pages/docs/guides/caching.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/pages/docs/guides/caching.md b/docs/src/pages/docs/guides/caching.md index 41bdd10406..12368432ca 100644 --- a/docs/src/pages/docs/guides/caching.md +++ b/docs/src/pages/docs/guides/caching.md @@ -26,5 +26,7 @@ Let's assume we are using the default `cacheTime` of **5 minutes** and the defau - Because this exact data exist in the cache from the first instance of this query, that data is immediately returned from the cache. - Both instances of the `useQuery('todos', fetchTodos)` query are unmounted and no longer in use. - Since there are no more active instances to this query, a cache timeout is set using `cacheTime` to delete and garbage collect the query (defaults to **5 minutes**). +- Before the cache timeout has completed another instance of `useQuery('todos', fetchTodos)` mounts. The query immediately returns the available cached value while the `fetchTodos` function is being run in the background to populate the query with a fresh value. +- The final instance of `useQuery('todos', fetchTodos)` unmounts. - No more instances of `useQuery('todos', fetchTodos)` appear within **5 minutes**. - This query and its data are deleted and garbage collected.