generate Cache Control Headerutility
utility
This utility function accepts a object and returns a string with the corresponding
cache-control
header.
Learn more about data fetching in Hydrogen.
Anchor to cacheOptions
cacheOptions
required
Anchor to generateCacheControlHeader-returnsReturnsstring
string
Was this section helpful?
Example code
import {data} from '@shopify/remix-oxygen';
import {generateCacheControlHeader, CacheShort} from '@shopify/hydrogen';
export async function loader() {
return data(
{some: 'data'},
{
headers: {
'cache-control': generateCacheControlHeader(CacheShort()),
},
},
);
}