import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Cachable, RequestCache } from './request-cache.service'; /** * A service that caches certain requests and responses to improve performance. * It is delegated to an interceptor without disturbing the existing data services. * * - If request is cachable (e.g., package search) and response is in cache, * then returns the cached response as observable. * - If request is cachable and has `REFRESH_X_CACHE` option header in true (or the request is not in cache), * then passes request to the following `HttpHandler` and makes a cache from response. * - If request is not cachable, * then passes request to the following `HttpHandler`. */ export declare class CachingInterceptor implements HttpInterceptor { private _cachable; private _cache; constructor(_cachable: Cachable, _cache: RequestCache); /** * Identifies and handles a given HTTP request. * @param req The outgoing request object to handle. * @param next The next interceptor in the chain, or the backend if no interceptors remain in the chain. * @returns An observable of the event stream. */ intercept(req: HttpRequest, next: HttpHandler): Observable>; /** * Gets server response observable by sending request to `next` argument. * It will add the response to the cache on the way out. * @param req The outgoing request object to handle. * @param maxAgeInCache The maximum cache age in milliseconds. * @param hasRefreshXCache It is true if the custom `REFRESH_X_CACHE` header is present; otherwise, false. * @param next The next interceptor in the chain, or the backend if no interceptors remain in the chain. * @returns An observable of the event stream. */ private _sendRequest; }