Edit this page

up.network up.cache.get(requestOptions)
JavaScript function

This feature is experimental. It may be changed or removed in a future version.

Returns an earlier request matching the given request options.

Returns undefined if the given request is not currently cached.

Note that up.request() will only write to the cache with { cache: true }.


let request = up.cache.get({ url: '/foo' })

if (request) {
  let response = await request
  console.log("Response is %o", response)
} else {
  console.log("The path /foo has not been requested before!")


requestOptions Object

The request options to match against the cache. See options for up.request() for documentation.

The user may configure up.network.config.requestMetaKeys to define which request options are relevant for cache matching.

Return value

The cached request.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more