Configuration for response caching behavior

interface ResponseCacheConfig {
    retention: ResponseRetention;
    ttl?: number;
    extendOnRefresh?: boolean;
    maxSize?: number;
}

Properties

Retention policy determining when response is cleaned up

ttl?: number

Time-to-live in milliseconds (required for TTL retention)

extendOnRefresh?: boolean

For TTL retention: extend TTL instead of replacing data on new request

When false (default): New request clears old data and stores new data with fresh TTL When true: If cached data exists and hasn't expired, extend TTL without replacing data

Use extendOnRefresh=true to avoid re-running expensive operations when cached data is still valid.

Default

false

Example

// Replace on each request (default)
cache: { retention: ResponseRetention.TTL, ttl: 5 * 60 * 1000 }

Example

// Extend TTL on refresh - avoid re-fetching if cache valid
cache: { retention: ResponseRetention.TTL, ttl: 5 * 60 * 1000, extendOnRefresh: true }
maxSize?: number

Maximum number of responses to cache per path (future use)