An object matching the @react-native-async-storage/async-storage
API (must have getItem and setItem methods).
A StorageAdapter with an additional init() method for cache hydration.
Reads are synchronous (from the in-memory cache), and writes update the
cache immediately then persist to AsyncStorage asynchronously (fire-and-forget).
Call init() once at app startup to hydrate the cache from AsyncStorage
before creating the store.
Using with @react-native-async-storage/async-storage:
import AsyncStorage from '@react-native-async-storage/async-storage';
import { createAsyncStorageAdapter, HiyveStoreRN } from '@hiyve/rn-core';
const storage = createAsyncStorageAdapter(AsyncStorage);
// Hydrate the cache before creating the store
await storage.init(['hiyve:audioDevice', 'hiyve:videoDevice']);
const store = new HiyveStoreRN(client, { storage });
Creates an AsyncStorage-backed adapter with a synchronous in-memory cache.