Skip to content

Commit efd7d32

Browse files
Clayton MarshallClayton Marshall
andauthored
docs: added more detailed explanation of what the cache timeout does in the detailed walkthough of useQuery (#928)
Co-authored-by: Clayton Marshall <[email protected]>
1 parent 8f6bdf3 commit efd7d32

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/src/pages/docs/guides/caching.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ Let's assume we are using the default `cacheTime` of **5 minutes** and the defau
2626
- Because this exact data exist in the cache from the first instance of this query, that data is immediately returned from the cache.
2727
- Both instances of the `useQuery('todos', fetchTodos)` query are unmounted and no longer in use.
2828
- 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**).
29+
- 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.
30+
- The final instance of `useQuery('todos', fetchTodos)` unmounts.
2931
- No more instances of `useQuery('todos', fetchTodos)` appear within **5 minutes**.
3032
- This query and its data are deleted and garbage collected.

0 commit comments

Comments
 (0)