@@ -64,7 +64,7 @@ export type CacheableNetOptions = {
6464 *
6565 * @default true
6666 */
67- useHttpCache ?: boolean ;
67+ httpCachePolicy ?: boolean ;
6868 /**
6969 * Custom function for converting JavaScript values to strings.
7070 * This is used when serializing request bodies for POST, PUT, PATCH, and DELETE methods.
@@ -105,7 +105,7 @@ export type ParseType = (value: string) => unknown;
105105
106106export class CacheableNet extends Hookified {
107107 private _cache : Cacheable = new Cacheable ( ) ;
108- private _useHttpCache = true ;
108+ private _httpCachePolicy = true ;
109109 private _stringify : StringifyType = JSON . stringify ;
110110 private _parse : ParseType = JSON . parse ;
111111
@@ -119,8 +119,8 @@ export class CacheableNet extends Hookified {
119119 : new Cacheable ( options . cache ) ;
120120 }
121121
122- if ( options ?. useHttpCache !== undefined ) {
123- this . _useHttpCache = options . useHttpCache ;
122+ if ( options ?. httpCachePolicy !== undefined ) {
123+ this . _httpCachePolicy = options . httpCachePolicy ;
124124 }
125125
126126 if ( options ?. stringify ) {
@@ -181,25 +181,25 @@ export class CacheableNet extends Hookified {
181181 }
182182
183183 /**
184- * Get the current HTTP cache setting.
184+ * Get the current HTTP cache policy setting.
185185 * @returns {boolean } Whether HTTP cache semantics are enabled
186186 */
187- public get useHttpCache ( ) : boolean {
188- return this . _useHttpCache ;
187+ public get httpCachePolicy ( ) : boolean {
188+ return this . _httpCachePolicy ;
189189 }
190190
191191 /**
192192 * Set whether to use HTTP cache semantics.
193193 * @param {boolean } value - Enable or disable HTTP cache semantics
194194 */
195- public set useHttpCache ( value : boolean ) {
196- this . _useHttpCache = value ;
195+ public set httpCachePolicy ( value : boolean ) {
196+ this . _httpCachePolicy = value ;
197197 }
198198
199199 /**
200200 * Fetch data from a URL with optional request options. Will use the cache that is already set in the instance.
201201 *
202- * When `useHttpCache ` is enabled (default), cache entries will have their TTL
202+ * When `httpCachePolicy ` is enabled (default), cache entries will have their TTL
203203 * set based on HTTP cache headers (e.g., Cache-Control: max-age). When disabled,
204204 * the default TTL from the Cacheable instance is used.
205205 *
@@ -214,7 +214,7 @@ export class CacheableNet extends Hookified {
214214 const fetchOptions : FetchOptions = {
215215 ...options ,
216216 cache : this . _cache ,
217- useHttpCache : this . _useHttpCache ,
217+ httpCachePolicy : this . _httpCachePolicy ,
218218 } ;
219219
220220 return fetch ( url , fetchOptions ) ;
@@ -234,7 +234,7 @@ export class CacheableNet extends Hookified {
234234 const fetchOptions : FetchOptions = {
235235 ...options ,
236236 cache : this . _cache ,
237- useHttpCache : this . _useHttpCache ,
237+ httpCachePolicy : this . _httpCachePolicy ,
238238 method : "GET" ,
239239 } ;
240240
@@ -311,7 +311,7 @@ export class CacheableNet extends Hookified {
311311 ...options ,
312312 headers,
313313 body : body as FetchOptions [ "body" ] ,
314- useHttpCache : this . _useHttpCache ,
314+ httpCachePolicy : this . _httpCachePolicy ,
315315 method : "POST" ,
316316 } ;
317317
@@ -361,7 +361,7 @@ export class CacheableNet extends Hookified {
361361 const fetchOptions : FetchOptions = {
362362 ...options ,
363363 cache : this . _cache ,
364- useHttpCache : this . _useHttpCache ,
364+ httpCachePolicy : this . _httpCachePolicy ,
365365 method : "HEAD" ,
366366 } ;
367367
@@ -414,7 +414,7 @@ export class CacheableNet extends Hookified {
414414 ...options ,
415415 headers,
416416 body : body as FetchOptions [ "body" ] ,
417- useHttpCache : this . _useHttpCache ,
417+ httpCachePolicy : this . _httpCachePolicy ,
418418 method : "PUT" ,
419419 } ;
420420
@@ -490,7 +490,7 @@ export class CacheableNet extends Hookified {
490490 ...options ,
491491 headers,
492492 body : body as FetchOptions [ "body" ] ,
493- useHttpCache : this . _useHttpCache ,
493+ httpCachePolicy : this . _httpCachePolicy ,
494494 method : "PATCH" ,
495495 } ;
496496
@@ -568,7 +568,7 @@ export class CacheableNet extends Hookified {
568568 ...options ,
569569 headers,
570570 body : body as FetchOptions [ "body" ] ,
571- useHttpCache : this . _useHttpCache ,
571+ httpCachePolicy : this . _httpCachePolicy ,
572572 method : "DELETE" ,
573573 } ;
574574
0 commit comments