chore(fetcher): cache only 2xx and 404 responses
This commit is contained in:
parent
5429b0cb7a
commit
d087318286
1 changed files with 2 additions and 2 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue