Architecture

Overview

API Cache Proxy is composed of several components that work together to provide a multi-level API caching gateway.

flowchart TB
    Client[Client / Application]
    Traefik[Traefik<br/>TLS + Authentication]
    Gateway[API Cache Proxy<br/>Go]
    L1[L1 Cache<br/>Memory]
    L2[L2 Cache<br/>Redis]
    Backend[Backend API]
    Prometheus[Prometheus]
    Appsmith[Appsmith<br/>Admin UI]

    Client --> Traefik
    Traefik --> Gateway

    Gateway --> L1
    L1 -->|MISS| L2
    L2 -->|MISS| Backend

    Backend --> L2
    L2 --> L1

    Prometheus -. Metrics .-> Gateway
    Appsmith -. Admin API .-> Gateway

Request Flow

The request flow through the API Cache Proxy is:

flowchart TD
    A[Incoming Request] --> B[Parse Target URL]
    B --> C[Evaluate Cache Policy]

    C -->|BYPASS| D[Backend]
    C -->|PUBLIC / PRIVATE| E[Generate Cache Key]

    E --> F{L1 Cache}
    F -->|HIT| G[Return Response]
    F -->|MISS| H{L2 Redis}

    H -->|HIT| I[Populate L1]
    I --> G

    H -->|MISS| D

    D --> J[Store in L2]
    J --> K[Store in L1]
    K --> G