americanexpress / fetchye

✨ If you know how to use Fetch, you know how to use Fetchye [fetch-yae]. Simple React Hooks, Centralized Cache, Infinitely Extensible.
Apache License 2.0
42 stars 21 forks source link

feat(compute-key): add support for mapKeyToCacheKey #71

Closed code-forger closed 1 year ago

code-forger commented 1 year ago

this option allows consumers to directly vary their cache key

Motivation and Context

This change enables more advanced caching features, where the cached data is not directly tied to a single complete url.

How Has This Been Tested?

unit tests, run locally in a module. This is a non-breaking change. No existing unit test was changed of fails.

Types of Changes

Checklist:

What is the Impact to Developers Using Fetchye?

New functionality

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a693a0755f25f64144b6b44872f5b7e215fccfcd:

Sandbox Source
quick-install Configuration
fetchye-provider-install Configuration
fetchye-redux-provider-install Configuration
nextjs-fetchye-ssr Configuration
aneudy1702 commented 1 year ago

@code-forger , thanks this is very promising. how does this work with the SSR request?

namely,

const fetchye = makeOneServerFetchye({ store, fetchClient });

is makeOneServerFetchye able to take this additional parameter to map the cache key?