UNPKG

791 BTypeScriptView Raw
1import IUrlFetcher from './IUrlFetcher';
2export declare const REQUEST_CACHE_DIR = "/tmp/dockter-request-cache";
3/**
4 * The default URL fetcher that Dockter uses. Fetches using `got` and caches results using `persist`
5 */
6export default class CachingUrlFetcher implements IUrlFetcher {
7 /**
8 * Fetch a URL using `got`, attempting to retrieve it from cache first.
9 */
10 fetchUrl(url: string, options?: any): Promise<any>;
11 /**
12 * Try to get a result from the `persist` cache. This method with initialise the `persist` cache if it has not been
13 * set up.
14 */
15 static getFromCache(url: string): Promise<any>;
16 /**
17 * Set a value (URL response body, usually) to the `persist` cache.
18 */
19 static setToCache(url: string, value: any): Promise<void>;
20}