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

Function withHttpTransferCache

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

Source from the content-addressed store, hash-verified

440 *
441 */
442export function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[] {
443 return [
444 {
445 provide: CACHE_OPTIONS,
446 useFactory: (): CacheOptions => {
447 performanceMarkFeature('NgHttpTransferCache');
448 return {isCacheActive: true, ...cacheOptions};
449 },
450 },
451 {
452 provide: HTTP_ROOT_INTERCEPTOR_FNS,
453 useValue: transferCacheInterceptorFn,
454 multi: true,
455 },
456 {
457 provide: APP_BOOTSTRAP_LISTENER,
458 multi: true,
459 useFactory: () => {
460 const appRef = inject(ApplicationRef);
461 const cacheState = inject(CACHE_OPTIONS);
462
463 return () => {
464 appRef.whenStable().then(() => {
465 cacheState.isCacheActive = false;
466 });
467 };
468 },
469 },
470 ];
471}
472
473/**
474 * 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