From 0afd0797870f9b096fced19f9b62a8155c3364dc Mon Sep 17 00:00:00 2001 From: arthurfiorette Date: Wed, 15 Feb 2023 21:12:08 -0300 Subject: [PATCH] docs: improved searched terms --- docs/src/config.md | 6 +++--- docs/src/guide/storages.md | 27 ++++++++++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/src/config.md b/docs/src/config.md index 9f3ac13b..4f8970a5 100644 --- a/docs/src/config.md +++ b/docs/src/config.md @@ -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._ diff --git a/docs/src/guide/storages.md b/docs/src/guide/storages.md index 021239ff..60037dd8 100644 --- a/docs/src/guide/storages.md +++ b/docs/src/guide/storages.md @@ -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 - -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. +## buildStorage() -- [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. +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! -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`: 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