MCPcopy Create free account
hub / github.com/angular/angular / withHttpTransferCache

Function withHttpTransferCache

packages/common/http/src/transfer_cache.ts:468–497  ·  view source on GitHub ↗
(cacheOptions: HttpTransferCacheOptions)

Source from the content-addressed store, hash-verified

466 *
467 */
468export function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[] {
469 return [
470 {
471 provide: CACHE_OPTIONS,
472 useFactory: (): CacheOptions => {
473 performanceMarkFeature('NgHttpTransferCache');
474 return {isCacheActive: true, ...cacheOptions};
475 },
476 },
477 {
478 provide: HTTP_ROOT_INTERCEPTOR_FNS,
479 useValue: transferCacheInterceptorFn,
480 multi: true,
481 },
482 {
483 provide: APP_BOOTSTRAP_LISTENER,
484 multi: true,
485 useFactory: () => {
486 const appRef = inject(ApplicationRef);
487 const cacheState = inject(CACHE_OPTIONS);
488
489 return () => {
490 appRef.whenStable().then(() => {
491 cacheState.isCacheActive = false;
492 });
493 };
494 },
495 },
496 ];
497}
498
499/**
500 * This function will add a proxy to an HttpHeader to intercept calls to get/has

Callers 2

resource_spec.tsFile · 0.90

Calls 4

injectFunction · 0.90
performanceMarkFeatureFunction · 0.85
thenMethod · 0.65
whenStableMethod · 0.65

Tested by

no test coverage detected