From 7182456d1c7d288e024d213c632d20d037bb68cb Mon Sep 17 00:00:00 2001 From: Juraj Uhlar Date: Mon, 27 Nov 2023 15:08:38 +0000 Subject: [PATCH] docs(readme): improve caching explanation DOC-8 (#56) * docs(readme): improve caching explanation * docs(readme): add link --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 273bc94..a9a7830 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,16 @@ See the full code in the provided [example applications](./examples). ## Caching strategy -Fingerprint Pro usage is billed per API call. To reduce API calls, it is a good practice to [cache identification results](https://dev.fingerprint.com/docs/caching-visitor-information). The SDK uses SessionStorage to cache results by default. +Fingerprint Pro usage is billed per API call. To avoid unnecessary API calls, it is a good practice to [cache identification results](https://dev.fingerprint.com/docs/caching-visitor-information). By default, the SDK uses `sessionStorage` to cache results. -> :warning: **WARNING** If you use data from `extendedResult`, pay additional attention to the caching strategy. -> -> Some fields from the [extendedResult](https://dev.fingerprint.com/docs/js-agent#extendedresult) (e.g., `ip` or `lastSeenAt`) might change over time for the same visitor. If you need to get the latest results, pass `{ignoreCache: true}` to the `getData()` function. +* Specify the `cacheLocation` prop on `` to instead store results in `memory` or `localStorage`. Use `none` to disable caching completely. +* Specify the `cache` prop on `` to use your custom cache implementation instead. For more details, see [Creating a custom cache](https://github.com/fingerprintjs/fingerprintjs-pro-spa#creating-a-custom-cache) + in the Fingerprint Pro SPA repository (a lower-level Fingerprint library used by this SDK). +* Pass `{ignoreCache: true}` to the `getData()` function to ignore cached results for that specific API call. + +> [!NOTE] +> If you use data from [`extendedResult`](https://dev.fingerprint.com/docs/js-agent#extendedresult), pay additional attention to your caching strategy. +> Some fields, for example, `ip` or `lastSeenAt`, might change over time for the same visitor. Use `getData({ ignoreCache: true })` to fetch the latest identification results. ## Documentation