API Documentation / @pinia/colada / useQueryCache
Variable: useQueryCache
ts
const useQueryCache: StoreDefinition<"_pc_query", Pick<{
caches: Ref<TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>, TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>>;
cancel: (entry, reason?) => void;
cancelQueries: (filters?, reason?) => void;
create: <TResult, TError, TDataInitial>(key, options, initialData?, error, when) => UseQueryEntry<TResult, TError, TDataInitial>;
ensure: <TResult, TError, TDataInitial>(opts, previousEntry?) => UseQueryEntry<TResult, TError, TDataInitial>;
ensureDefinedQuery: <T>(fn) => DefineQueryEntry;
extend: <TResult, TError>(_entry) => void;
fetch: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
getEntries: (filters) => UseQueryEntry<unknown, unknown, unknown>[];
getQueryData: <TResult>(key) => undefined | TResult;
invalidate: (entry) => void;
invalidateQueries: (filters?) => Promise<unknown>;
refresh: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
remove: (entry) => void;
setEntryState: <TResult, TError>(entry, state) => void;
setQueryData: <TResult>(key, data) => void;
track: (entry, effect) => void;
untrack: (entry, effect) => void;
}, "caches" | "_s">, Pick<{
caches: Ref<TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>, TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>>;
cancel: (entry, reason?) => void;
cancelQueries: (filters?, reason?) => void;
create: <TResult, TError, TDataInitial>(key, options, initialData?, error, when) => UseQueryEntry<TResult, TError, TDataInitial>;
ensure: <TResult, TError, TDataInitial>(opts, previousEntry?) => UseQueryEntry<TResult, TError, TDataInitial>;
ensureDefinedQuery: <T>(fn) => DefineQueryEntry;
extend: <TResult, TError>(_entry) => void;
fetch: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
getEntries: (filters) => UseQueryEntry<unknown, unknown, unknown>[];
getQueryData: <TResult>(key) => undefined | TResult;
invalidate: (entry) => void;
invalidateQueries: (filters?) => Promise<unknown>;
refresh: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
remove: (entry) => void;
setEntryState: <TResult, TError>(entry, state) => void;
setQueryData: <TResult>(key, data) => void;
track: (entry, effect) => void;
untrack: (entry, effect) => void;
}, never>, Pick<{
caches: Ref<TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>, TreeMapNode<UseQueryEntry<unknown, unknown, unknown>>>;
cancel: (entry, reason?) => void;
cancelQueries: (filters?, reason?) => void;
create: <TResult, TError, TDataInitial>(key, options, initialData?, error, when) => UseQueryEntry<TResult, TError, TDataInitial>;
ensure: <TResult, TError, TDataInitial>(opts, previousEntry?) => UseQueryEntry<TResult, TError, TDataInitial>;
ensureDefinedQuery: <T>(fn) => DefineQueryEntry;
extend: <TResult, TError>(_entry) => void;
fetch: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
getEntries: (filters) => UseQueryEntry<unknown, unknown, unknown>[];
getQueryData: <TResult>(key) => undefined | TResult;
invalidate: (entry) => void;
invalidateQueries: (filters?) => Promise<unknown>;
refresh: <TResult, TError, TDataInitial>(entry, options) => Promise<DataState<TResult, TError, TDataInitial>>;
remove: (entry) => void;
setEntryState: <TResult, TError>(entry, state) => void;
setQueryData: <TResult>(key, data) => void;
track: (entry, effect) => void;
untrack: (entry, effect) => void;
},
| "ensureDefinedQuery"
| "setQueryData"
| "getQueryData"
| "invalidateQueries"
| "cancelQueries"
| "invalidate"
| "fetch"
| "refresh"
| "ensure"
| "extend"
| "track"
| "untrack"
| "cancel"
| "create"
| "remove"
| "setEntryState"
| "getEntries">>;
Composable to get the cache of the queries. As any other composable, it can be used inside the setup
function of a component, within another composable, or in injectable contexts like stores and navigation guards.