What is a Cache Provider in SWR
mainBy default, SWR uses a global cache to store and share data across components. A Cache Provider allows you to customize this behavior by providing a custom storage mechanism (e.g., localStorage, IndexedDB).
A Cache Provider must be a Map-like object that implements the following Cache<Data> interface:
interface Cache<Data> {
get(key: string): Data | undefined
set(key: string, value: Data): void
delete(key: string): void
keys(): IterableIterator<string>
}For example, a standard JavaScript Map instance satisfies this interface and can be used directly.