staleTtl
PRO

Type:
<string> | <number>

It enables serve a stale response while a background refresh cache copy is being generated over the target url.
  • CLI
  • JavaScript
  • Shell
  • Python
  • Ruby
const mql = require('@microlink/mql')

const { status, data } = await mql('https://microlink.io', { ttl: '1d', staleTtl: 0 })

mql.render(data)
The value provided can't be higher than ttl.
A good pattern there is to sets 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.