Create a new cache manager
Cache manager configuration
Execute a function with caching support
Function to execute with caching
Optional
key: stringOptional cache key (if not provided, caching is disabled)
Optional
ttl: numberOptional TTL in milliseconds
Result of the function with caching applied
Static
createStatic
createCreate a new cache manager with resilient caching configuration
This factory method creates a CacheManager with a ResilientCache strategy, providing enhanced stability, error handling, and fallback capabilities.
Features:
Resilient cache configuration
A configured CacheManager with resilient caching
// Create a cache manager with in-memory primary and localStorage fallback
const cacheManager = CacheManager.createResilient({
primary: new InMemoryCache(),
fallback: new LocalStorageCache('api_cache_'),
retries: 3,
telemetry: (event, details) => {
console.log(`Cache event: ${event}`, details);
}
});
Generated using TypeDoc
Cache manager for the API client