Skip to content

Commit cd92124

Browse files
update cache key to query key (#1202)
1 parent c0c7348 commit cd92124

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/routes/solid-router/reference/data-apis/query.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,24 @@ export default function User(props) {
7777
Any user based navigation or link click bypasses this cache.
7878
Revalidation or new fetch updates the cache.
7979

80-
## Cache Keys
80+
## Query Keys
8181

82-
To ensure that the cache keys are consistent and unique, arguments are deterministically serialized using `JSON.stringify`.
82+
To ensure that the query keys are consistent and unique, arguments are deterministically serialized using `JSON.stringify`.
8383
Before serialization, key/value pairs in objects are sorted so that the order of properties does not affect the serialization.
84-
For instance, both `{ name: 'Ryan', awesome: true }` and `{ awesome: true, name: 'Ryan' }` will serialize to the same string so that they produce the same cache key.
84+
For instance, both `{ name: 'Ryan', awesome: true }` and `{ awesome: true, name: 'Ryan' }` will serialize to the same string so that they produce the same query key.
8585

8686
## Return value
8787

8888
The return value is a `CachedFunction`, a function that has the same signature as the function you passed to `query`.
89-
This cached function stores the return value using the cache key.
89+
This cached function stores the return value using the query key.
9090
Under most circumstances, this temporarily prevents the passed function from running with the same arguments, even if the created function is called repeatedly.
9191

9292
## Arguments
9393

9494
| argument | type | description |
9595
| -------- | ----------------------- | ------------------------------------------------------------------------- |
9696
| `fn` | `(...args: any) => any` | A function whose return value you'd like to be cached. |
97-
| `name`\* | string | Any arbitrary string that you'd like to use as the rest of the cache key. |
97+
| `name`\* | string | Any arbitrary string that you'd like to use as the rest of the query key. |
9898

9999
\*Since the internal cache is shared by all the functions using `query`, the string should be unique for each function passed to `query`.
100100
If the same key is used with multiple functions, one function might return the cached result of the other.

src/routes/solid-router/reference/response-helpers/reload.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: reload
33
---
44

55
Reload is a response helper built on top of [revalidate](/solid-router/reference/response-helpers/revalidate).
6-
It will receive a cache key, or an array of cache keys, to invalidate those queries, and cause them to fire again.
6+
It will receive a query key, or an array of query keys, to invalidate those queries, and cause them to fire again.
77

88
```ts title="/actions/update-todo.ts" {7}
99
import { action, reload } from "@solidjs/router";
@@ -16,7 +16,7 @@ const updateTodo = action(async (todo: Todo) => {
1616
});
1717
```
1818

19-
The code snippet above uses the cache-key from a user-defined query (`getTodo`).
19+
The code snippet above uses the query key from a user-defined query (`getTodo`).
2020
To better understand how queries work, check the [query](/solid-router/reference/data-apis/query) documentation.
2121

2222
## TypeScript Signature

src/routes/solid-router/reference/response-helpers/revalidate.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: revalidate
33
---
44

5-
Revalidate will receive the either a cache key or an array of cache keys and invalidate those queries.
5+
Revalidate will receive the either a query key or an array of query keys and invalidate those queries.
66

77
:::tip[Firing Queries Again]
88
If you intend to re-fire the queries immediately, check the [reload](/solid-router/reference/response-helpers/reload) helper.
99
:::
1010

11-
The code below will revalidate the `getTodo` query with the cache key.
11+
The code below will revalidate the `getTodo` query with the query key.
1212

1313
```ts title="/actions/update-todo.ts" {6}
1414
import { action, revalidate } from "@solidjs/router";

0 commit comments

Comments
 (0)