feat: better override documentation

This commit is contained in:
arthurfiorette 2022-06-05 11:26:17 -03:00
parent 268fccb935
commit 338c9a6888
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555
2 changed files with 19 additions and 3 deletions

View File

@ -160,3 +160,15 @@ Possible types:
- `number` -> the max time (in seconds) that the cache can be reused.
- `boolean` -> `false` disables and `true` enables with infinite time.
- `function` -> a predicate that can return `number` or `boolean` as described above.
## `cache.override`
This options causes the interceptors bypass the current cache and always make a new http
request. This will not delete the current cache, it will just replace the cache when the
response arrives.
Unlike from `cache: false`, this will not disable the cache, it will just ignore the cache
checks before making the request. This way, all options are still available and will work
as expected.
Default: `false`

10
src/cache/cache.ts vendored
View File

@ -111,9 +111,13 @@ export type CacheProperties<R = unknown, D = unknown> = {
staleIfError: StaleIfErrorPredicate<R, D>;
/**
* This options makes the interceptors ignore the available cache and always make a new
* request. But, different from `cache: false`, this will not delete the current cache
* and will update the cache when the request is successful.
* This options causes the interceptors bypass the current cache and always make a new
* http request. This will not delete the current cache, it will just replace the cache
* when the response arrives.
*
* Unlike from `cache: false`, this will not disable the cache, it will just ignore the
* cache checks before making the request. This way, all options are still available and
* will work as expected.
*
* @default false
*/