# Cache Feature Configuration
#
# This configuration controls caching behavior for improved performance.
# Supports both in-memory caching (Moka) and Redis for distributed caching.
# This file is loaded ONLY if [server.features.cache].enabled = true in the main config.
# (The enabled flag is set in the main lifecycle-api-config.toml file)

[cache]

# Cache backend: "memory" (in-process) or "redis" (distributed)
# memory: Fast, in-process, but not shared across instances
# redis: Shared across instances, requires Redis server
backend = "memory"

# Maximum number of items in cache
max_items = 10000

# Cache entry time-to-live (seconds)
# Items older than this are automatically evicted
ttl_seconds = 3600

# ============================================================================
# In-Memory Cache Configuration (if backend = "memory")
# ============================================================================

[cache.memory]

# Enable time-based eviction (removes old items periodically)
eviction_enabled = true

# How often to check for expired items (seconds)
eviction_interval_seconds = 300

# ============================================================================
# Redis Cache Configuration (if backend = "redis")
# ============================================================================

[cache.redis]

# Redis server connection string
# Format: redis://username:password@host:port/db
# Example: redis://default:mypassword@localhost:6379/0
connection_url = "redis://localhost:6379/0"

# Connection timeout (milliseconds)
connection_timeout_ms = 5000

# Prefix for all cache keys (to avoid collisions with other services)
key_prefix = "lifecycle:"
