MCPcopy Index your code
hub / github.com/angular/angular / cacheStatus

Function cacheStatus

packages/service-worker/worker/src/assets.ts:86–103  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

84 }
85
86 async cacheStatus(url: string): Promise<UpdateCacheStatus> {
87 const cache = await this.cache;
88 const meta = await this.metadata;
89 const req = this.adapter.newRequest(url);
90 const res = await cache.match(req, this.config.cacheQueryOptions);
91 if (res === undefined) {
92 return UpdateCacheStatus.NOT_CACHED;
93 }
94 try {
95 const data = await meta.read<UrlMetadata>(req.url);
96 if (!data.used) {
97 return UpdateCacheStatus.CACHED_BUT_UNUSED;
98 }
99 } catch (_) {
100 // Error on the side of safety and assume cached.
101 }
102 return UpdateCacheStatus.CACHED;
103 }
104
105 /**
106 * Initialize this asset group, updating from the given source if available.

Callers

nothing calls this directly

Calls 2

newRequestMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…