Skip to content

Commit

Permalink
feat: better override documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Jun 5, 2022
1 parent 268fccb commit 338c9a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 12 additions & 0 deletions docs/pages/per-request-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 7 additions & 3 deletions src/cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 338c9a6

Please sign in to comment.