chore(fetcher): cache only 2xx and 404 responses

This commit is contained in:
WebStreamr 2025-09-12 18:24:19 +00:00
parent 5429b0cb7a
commit d087318286
No known key found for this signature in database

View file

@ -195,11 +195,11 @@ export class Fetcher {
}
private determineCacheTtl(status: number, policy: CachePolicy, init?: CustomRequestInit): number {
if (status === 200 || status === 404) {
if ((status >= 200 && status <= 299) || status === 404) {
return Math.max(policy.timeToLive(), init?.minCacheTtl ?? this.MIN_CACHE_TTL);
}
return policy.timeToLive();
return 0;
};
private async cacheGet(key: string): Promise<HttpCacheItem | undefined> {