Cache Noneutility
utility
The CacheNone() strategy instructs caches not to store any data. The function accepts no arguments.
Learn more about data fetching in Hydrogen.
Anchor to cacheNonecache None()
cache None()
Anchor to cacheNone-returnsReturns
- modestring
NoStoreStrategy
CacheNoneGeneratedType
NoStoreStrategy
export function CacheNone(): NoStoreStrategy {
return {
mode: NO_STORE,
};
}
NoStoreStrategy
- mode
string
{
mode: string;
}
Was this section helpful?
Example code
import {CacheNone} from '@shopify/hydrogen';
export async function loader({context}) {
const data = await context.storefront.query(
`#grahpql
{
shop {
name
description
}
}
`,
{
cache: CacheNone(),
},
);
return data;
}
examples
Example code
description
I am the default example
JavaScript
import {CacheNone} from '@shopify/hydrogen'; export async function loader({context}) { const data = await context.storefront.query( `#grahpql { shop { name description } } `, { cache: CacheNone(), }, ); return data; }
TypeScript
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen'; import {CacheNone} from '@shopify/hydrogen'; export async function loader({context}: LoaderFunctionArgs) { const data = await context.storefront.query( `#grahpql { shop { name description } } `, { cache: CacheNone(), }, ); return data; }