diff --git a/docs/src/config.md b/docs/src/config.md index 082b32d3..e2f5e1eb 100644 --- a/docs/src/config.md +++ b/docs/src/config.md @@ -1,6 +1,7 @@ -# Global +# setupCache() -These are properties that are used and shared by the entire application. +The `setupCache` function receives the axios instance and a set of optional properties +described below. They are used and shared by the entire application workflow. ```ts const axios = setupCache(axios, OPTIONS); diff --git a/docs/src/config/request-specifics.md b/docs/src/config/request-specifics.md index 7b5a55cf..feb7c04f 100644 --- a/docs/src/config/request-specifics.md +++ b/docs/src/config/request-specifics.md @@ -182,7 +182,8 @@ exceptions to the method rule. _(These default status codes follows RFC 7231)_ An object or function that will be tested against the response to indicate if it can be -cached. +cached. You can use `statusCheck`, `containsHeader` and `responseMatch` to test against +the response. ```ts{5,8,13} axios.get<{ auth: { status: string } }>('url', { diff --git a/docs/src/guide/request-id.md b/docs/src/guide/request-id.md index 4cd59511..70c31277 100644 --- a/docs/src/guide/request-id.md +++ b/docs/src/guide/request-id.md @@ -50,7 +50,7 @@ any possible differences between them and share the same cache for both. If the default generator is not enough for your use case, you can provide your own custom generator with the `generateKey` option. -By default, it extracts `method`, `baseURL`, `params`, `data` and `url` properties from +By default, it extracts `method`, `baseURL`, `query`, `params`, `data` and `url` properties from the request object and hashes it into a number with [`object-code`](https://www.npmjs.com/package/object-code). diff --git a/docs/src/guide/storages.md b/docs/src/guide/storages.md index 8eb609c7..83b9e932 100644 --- a/docs/src/guide/storages.md +++ b/docs/src/guide/storages.md @@ -50,6 +50,19 @@ setupCache(axios, { }); ``` +Options: + +- **cloneData**: Use `true` if the data returned by `find()` should be cloned to avoid + mutating the original data outside the `set()` method. Use `'double'` to also clone + before saving value in storage using `set()`. Disabled is default + +- **cleanupInterval**: The interval in milliseconds to run a setInterval job of cleaning + old entries. If false, the job will not be created. Disabled is default + +- **maxEntries**: The maximum number of entries to keep in the storage. Its hard to + determine the size of the entries, so a smart FIFO order is used to determine eviction. + If false, no check will be done and you may grow up memory usage. Disabled is default + ## Web Storage API If you need persistent caching between page refreshes, you can use the `buildWebStorage`