- Cache applies to
GETrequests. - Key format:
METHOD::resolvedURL::stable(params). - Supports TTL expiration.
- Supports stale-while-revalidate (SWR).
- Nitro cache adapter is used when:
react-native-nitro-modulesis installed in the app, andNitroCacheHybridObject is registered on native side.
- Fallback to JS Map cache is automatic when Nitro is unavailable.
- In-flight dedupe applies to identical
GETrequests only. - Non-GET requests are not deduped to avoid side-effect collisions.
api.invalidate(); // all known cache keys
api.invalidate({ method: 'GET', url: '/users' });
api.clearCache();When SWR is enabled and a cached entry is stale:
- stale value is returned immediately
- background request refreshes cache asynchronously
Use SWR for low-latency read-heavy screens where eventual freshness is acceptable.