Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.draskencloud.com/llms.txt

Use this file to discover all available pages before exploring further.

Response caching is disabled by default. Enable it globally and configure per-app or per-endpoint via the cache policy field.

Enable Caching Globally

GATEWAY_CACHE__ENABLED=true
GATEWAY_CACHE__BACKEND=memory        # memory | redis | memcached
GATEWAY_CACHE__DEFAULT_TTL_SECS=60
For Redis:
GATEWAY_CACHE__BACKEND=redis
GATEWAY_CACHE__REDIS__URL=redis://redis:6379

Cache Policy

{
  "cache": {
    "enabled": true,
    "ttl_secs": 300,
    "vary_on": ["Authorization", "Accept-Language"],
    "cache_control_passthrough": true,
    "cache_methods": ["GET", "HEAD"]
  }
}

Fields

FieldDefaultDescription
enabledfalseEnable caching for this app/endpoint
ttl_secs60Time-to-live for cached entries in seconds
vary_onRequest header names mixed into the cache key
cache_control_passthroughtrueHonour upstream Cache-Control: no-store/no-cache/private
cache_methods["GET","HEAD"]HTTP methods to cache

Apply to an App

curl -X POST http://localhost:9090/api/v1/apps \
  -d '{
    "name": "Public API",
    "slug": "public-api",
    "gateway_path": "/public",
    "default_policy": {
      "cache": {
        "enabled": true,
        "ttl_secs": 120,
        "vary_on": ["Accept-Language"]
      }
    }
  }'

Purge Cache

curl -X POST http://localhost:9090/api/v1/cache/purge \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Backends

BackendNotes
memoryIn-process LRU cache. Lost on restart. Single instance only
redisShared across instances. Recommended for multi-pod deployments
memcachedAlternative shared cache