import mql from '@microlink/mql' const { data } = await mql('https://microlink.io', { ttl: "1d", staleTtl: 0 })
staleTtlPRO
Type:
Default: false
<string> | <number> | <boolean>
Default: false
It enables serve a stale response while a background refresh cache copy is being generated over the target url.
The value provided can't be higher than ttl, being supported the following formats:
- as number in milliseconds (e.g., 86400000).
- as humanized representation of the number (e.g., '24h').
The following humanized number variations are supported:
A good pattern is to set
staleTtl=0
to always revalidate in the background under expiration, maximizing the cache usage serving the last cache copy generated while the revalidation will refresh it.