Cache and storage
The SDK keeps controller responses in an internal in-memory LRU cache with TTL eviction for the life of the page. Nothing in this cache survives a page load. Configurestorage separately when you want to persist prepared search IDs across pages:
cache object exposed in v2 has been removed. Cache behavior is controlled through cache in SdkConfig. The optional storage value is used only by the search prepare store.
Cache configuration
Controller responses stay in memory only. The SDK uses the configured
StorageBackend to persist prepared search IDs so a later page can reuse them. Pass a backend such as localStorage, sessionStorage, or a custom implementation when you need cross-page prepare reuse.
StorageBackend
A storage backend persists prepared search IDs. It is any object matching this subset of theStorage interface:
localStorage or sessionStorage when you want prepared search IDs to survive navigation within the browser:
Custom fetch
The SDK uses the globalfetch by default. You can provide a custom fetch implementation for SSR, testing, or environments where fetch is not available:
xhrFetch, an XMLHttpRequest-based fetch alternative for environments where fetch is blocked by ad blockers or browser extensions:
Singleton access
After initialization, access the SDK anywhere:Technical details
- Runtime: Browser (ESM) and Node.js with a custom
fetchandstorage - TypeScript: Full type definitions included
- Dependencies: None
- Bundle: Tree-shakeable ES modules
- Caching: In-memory LRU cache with TTL for controller responses
- Request deduplication: In-flight requests with the same parameters are deduplicated
- Prepared search IDs: Optional storage backend with a five-minute default TTL