cache
Edit this pagecache is a deprecated alias for query.
Import
import { cache } from "@solidjs/router";Type
const cache: typeof query;Parameters
cache has the same parameters as query.
Return value
- Type:
CachedFunction<T>
cache returns the same value as query.
Behavior
cacheandqueryreference the same function.- Cache keys, reuse behavior, static methods, and revalidation behavior are the same as
query.
Examples
Basic usage
import { cache } from "@solidjs/router";
const getUser = cache(async (id: string) => { const response = await fetch(`/api/users/${id}`); return response.json();}, "user");