Cache configuration for optimizing repeated data fetches.
Remarks
Configures in-memory caching behavior to reduce redundant API calls and
improve performance. The cache automatically evicts expired entries based
on TTL and removes least-recently-used items when maxSize is reached.
Use appropriate TTL values based on your data freshness requirements.
Example
// Short-lived cache for frequently changing data constuserCache: CacheConfig = { ttl:60000, // 1 minute maxSize:100, // Store up to 100 users prefix:'user:'// Cache keys like 'user:123' };
// Long-lived cache for stable data constschemaCache: CacheConfig = { ttl:3600000, // 1 hour maxSize:1000, // Store up to 1000 schemas prefix:'schema:' };
// Disable caching by setting TTL to 0 constnoCache: CacheConfig = { ttl:0// No caching };
Cache configuration for optimizing repeated data fetches.
Remarks
Configures in-memory caching behavior to reduce redundant API calls and improve performance. The cache automatically evicts expired entries based on TTL and removes least-recently-used items when maxSize is reached. Use appropriate TTL values based on your data freshness requirements.
Example