docs: improved searched terms

This commit is contained in:
arthurfiorette 2023-02-15 21:12:08 -03:00
parent 0a7a705df4
commit 0afd079787
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555
2 changed files with 19 additions and 14 deletions

View File

@ -64,9 +64,9 @@ The function used to interpret all headers from a request and determine a time t
::: warning
Many backends returns `Cache-Control: no-cache` or `Cache-Control: no-store` headers,
which results in this library not caching at all. You shall disable `headerInterpreter`
for those requests.
Many REST backends returns some variation of `Cache-Control: no-cache` or
`Cache-Control: no-store` headers, which tell us to ignore caching at all. You shall
disable `headerInterpreter` for those requests.
_If the debug mode prints `Cache header interpreted as 'dont cache'` this is probably the
reason._

View File

@ -99,19 +99,13 @@ The eviction is done by the following algorithm:
5. If it still fails, the data is not saved. _Probably because the whole key is greater
than the quota or other libraries already consumed the whole usable space._
## Third Party Storages
## buildStorage()
These are not guaranteed to work with the latest version of the library, neither are
maintained by the axios cache interceptor team. But, as we provide a minimal interface for
storages, you can use them as a base to also create your own.
All integrated storages are wrappers around the `buildStorage` function. External
libraries use it and if you want to build your own, `buildStorage` is the way to go!
- [Node Redis v4](#node-redis-v4-example)
- **Have another one?**
[Open a PR](https://github.com/arthurfiorette/axios-cache-interceptor/pulls) to add it
here.
The exported `buildStorage` abstracts the storage interface and requires a super simple
object to build the storage. It has 3 methods:
The exported `buildStorage` function abstracts the storage interface and requires a super
simple object to build the storage. It has 3 methods:
- `set(key: string, value: NotEmptyStorageValue, currentRequest?: CacheRequestConfig): MaybePromise<void>`:
Receives the key and the value, and optionally the current request. It should save the
@ -124,6 +118,17 @@ object to build the storage. It has 3 methods:
Receives the key and optionally the current request. It should return the value from the
storage or `undefined` if not found.
## Third Party Storages
These are not guaranteed to work with the latest version of the library, neither are
maintained by the axios cache interceptor team. But, as we provide a minimal interface for
storages, you can use them as a base to also create your own.
- [Node Redis v4](#node-redis-v4-example)
- **Have another one?**
[Open a PR](https://github.com/arthurfiorette/axios-cache-interceptor/pulls) to add it
here.
## Node Redis Example
To inspire you, here is an example for a server-side application that uses Redis as the