API Cache: Our backend maintains a distributed cache to ensure high availability and reliability, even during service disruptions.
SDK Local Cache: The SDK includes a built-in local cache that stores recently retrieved prompts to minimize network requests and improve response times.
The SDK automatically handles cache invalidation in the following scenarios:
When the cache duration expires (default: 5 minutes)
When explicitly requested with cache: false
When using the API to update or modify prompts (the API invalidates relevant cache entries)
For manual cache control, you can use the cache management methods:
Copy
Ask AI
// Clear the entire cacheawait basalt.cache.clear()// Clear cache for a specific promptawait basalt.cache.invalidate('prompt', 'welcome-message')// Clear cache for a prompt categoryawait basalt.cache.invalidate('feature', 'onboarding')