Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CachingUrlFetcher

The default URL fetcher that Dockta uses. Fetches using got and caches results using persist

Hierarchy

  • CachingUrlFetcher

Implements

Index

Methods

fetchUrl

  • fetchUrl(url: string, options?: any): Promise<any>
  • Fetch a URL using got, attempting to retrieve it from cache first.

    Parameters

    • url: string
    • Default value options: any = { responseType: 'json' }

    Returns Promise<any>

Static getFromCache

  • getFromCache(url: string): Promise<any>
  • Try to get a result from the persist cache. This method with initialise the persist cache if it has not been set up.

    Parameters

    • url: string

    Returns Promise<any>

Static setToCache

  • setToCache(url: string, value: any): Promise<void>
  • Set a value (URL response body, usually) to the persist cache.

    Parameters

    • url: string
    • value: any

    Returns Promise<void>

Generated using TypeDoc