kinetex - v1.0.0-rc.1
    Preparing search index...

    Interface CacheConfig

    Configuration options for the HTTP cache.

    interface CacheConfig {
        maxEntries?: number;
        maxSizeBytes?: number;
        maxBodySizeBytes?: number;
        defaultTtlMs?: number;
        maxAbsoluteAgeMs?: number;
        honorCacheControl?: boolean;
        cacheMethods?: string[];
        cacheStatuses?: number[];
        cacheKey?: (req: CacheableRequest) => string | Promise<string>;
        storage?: CacheStorageAdapter;
        namespace?: string;
    }
    Index

    Properties

    maxEntries?: number

    Maximum number of entries (LRU eviction). Default: 500

    maxSizeBytes?: number

    Maximum total size in bytes. Default: 50MB

    maxBodySizeBytes?: number

    Maximum response body size to cache in bytes. Default: 5MB

    defaultTtlMs?: number

    Default TTL in ms when no Cache-Control is present. Default: 60_000. Max: 1 year

    maxAbsoluteAgeMs?: number

    Maximum absolute age in ms for any cached entry, regardless of Cache-Control. Default: 7 days

    honorCacheControl?: boolean

    Honor Cache-Control: no-store / no-cache. Default: true

    cacheMethods?: string[]

    Only cache these methods. Default: ["GET", "HEAD"]

    cacheStatuses?: number[]

    Only cache these status codes. Default: [200,203,204,206,300,301,304,404,405,410,414,501]

    cacheKey?: (req: CacheableRequest) => string | Promise<string>

    Custom cache key function (may be async)

    Storage adapter for persistence. Default: in-memory

    namespace?: string

    Namespace prefix for all keys