Amplify Toolbox
    Preparing search index...

    Type Alias CacheConfig

    type CacheConfig = {
        computeResource: string;
        driver?: "opennext" | "nitro-s3";
        initFunction?: { bundle: string; handler: string };
        revalidationFunction?: { bundle: string; handler: string };
        revalidationQueue?: boolean;
        seedDirectory?: string;
        tagRevalidation?: boolean;
    }
    Index

    Properties

    computeResource: string

    Which compute resource handles cached content

    driver?: "opennext" | "nitro-s3"

    Cache backend the adapter wants the L3 to provision.

    • 'opennext' (default for backwards compatibility) — DynamoDB tag table + SQS revalidation queue + worker Lambda + S3 cache bucket. Used by the Next.js / OpenNext adapter.
    • 'nitro-s3' — single S3 bucket, no SQS, no worker. Used by the Nitro adapter; works with Nitro's useStorage('cache') model where refresh happens inline in the SSR Lambda.
    initFunction?: { bundle: string; handler: string }

    One-shot initialization function that seeds the DynamoDB tag table with the build's prebuilt tag→path rows (OpenNext's dynamodb-provider, which reads its bundled dynamodb-cache.json). The L3 wires it as a CloudFormation custom resource that runs once per deploy. Without it, tag-based revalidation can't purge a page until that page has been requested at least once. Only honoured when driver === 'opennext' and tagRevalidation is true.

    Type Declaration

    • bundle: string

      Path to the initialization function bundle directory

    • handler: string

      Handler entry point (e.g. 'index.handler')

    revalidationFunction?: { bundle: string; handler: string }

    Background revalidation worker function.

    When present, a Lambda is deployed with the SQS revalidation queue as its event source. This worker processes ISR revalidation messages and refreshes stale pages in the background. Only honoured when driver === 'opennext'.

    Type Declaration

    • bundle: string

      Path to the revalidation function bundle directory

    • handler: string

      Handler entry point (e.g. 'index.handler')

    revalidationQueue?: boolean

    Whether async revalidation queue is needed (provisions SQS). Only honoured when driver === 'opennext'.

    seedDirectory?: string

    Directory of prebuilt incremental-cache files to seed the S3 cache bucket with at deploy time (OpenNext's .open-next/cache). Without this, every prerendered ISR/SSG page is a cold render on first request (cache MISS) until it self-populates. The L3 uploads this directory's contents to the cache bucket under the build-id prefix the runtime reads. Only honoured when driver === 'opennext'.

    tagRevalidation?: boolean

    Whether tag-based revalidation is needed (provisions DynamoDB). Only honoured when driver === 'opennext'.