Module: core/base-service/resource-cache

Methods

(async, inner) getCachedResource(attrs) → {Promise.<*>}

Make a HTTP request using an in-memory cache

Parameters:
Name Type Description
attrs object

Refer to individual attrs

Properties
Name Type Attributes Default Description
url string

URL to request

ttl number

Number of milliseconds to keep cached value for

json boolean <optional>
true

True if we expect to parse the response as JSON

scraper function <optional>
buffer => buffer

Function to extract value from the response

options object <optional>
{}

Options to pass to got

requestFetcher function <optional>
fetch

Custom fetch function

Source:
Throws:
  • Error if unable to parse response
Type
InvalidResponse
Returns:

Promise that resolves to parsed response

Type
Promise.<*>