# Tiered Storage Configuration # Copy this file to .env and configure for your environment # ============================================================================ # S3 Configuration (Cold Tier - Required) # ============================================================================ # AWS S3 bucket name (or S3-compatible bucket) S3_BUCKET=tiered-storage-cache # Optional: Separate bucket for metadata (RECOMMENDED for production!) # When set, metadata is stored as separate JSON objects instead of S3 object metadata. # This allows fast, cheap metadata updates without copying entire objects. # Leave blank to store metadata in S3 object metadata fields (slower, more expensive). S3_METADATA_BUCKET=tiered-storage-metadata # AWS region S3_REGION=us-east-1 # S3 endpoint (optional - for S3-compatible services like R2, Minio) # Leave blank for AWS S3 # For Cloudflare R2: https://YOUR-ACCOUNT-ID.r2.cloudflarestorage.com # For MinIO: http://localhost:9000 # For other S3-compatible: https://s3.your-service.com # S3_ENDPOINT= # Force path-style URLs (usually needed for S3-compatible services) # Default: true (recommended for most S3-compatible services) # Set to false only if your service requires virtual-host-style URLs # S3_FORCE_PATH_STYLE=true # AWS credentials # If not provided, uses default AWS credential chain # (environment variables, ~/.aws/credentials, IAM roles, etc.) AWS_ACCESS_KEY_ID=your_access_key_id AWS_SECRET_ACCESS_KEY=your_secret_access_key # ============================================================================ # Cloudflare R2 Example Configuration # ============================================================================ # Uncomment these to use Cloudflare R2 instead of AWS S3: # # S3_BUCKET=my-r2-bucket # S3_METADATA_BUCKET=my-r2-metadata-bucket # S3_REGION=auto # S3_ENDPOINT=https://YOUR-ACCOUNT-ID.r2.cloudflarestorage.com # AWS_ACCESS_KEY_ID=your_r2_access_key_id # AWS_SECRET_ACCESS_KEY=your_r2_secret_access_key # ============================================================================ # Memory Tier Configuration (Hot) # ============================================================================ # Maximum size in bytes for hot (memory) tier # Default: 100MB MEMORY_MAX_SIZE_BYTES=104857600 # Maximum number of items in hot tier # Optional - if not set, only size limit applies MEMORY_MAX_ITEMS=1000 # ============================================================================ # Disk Tier Configuration (Warm) # ============================================================================ # Directory for warm tier cache # Default: ./cache/warm DISK_WARM_DIRECTORY=./cache/warm # Maximum size in bytes for warm tier # Optional - if not set, no size limit DISK_WARM_MAX_SIZE_BYTES=10737418240 # Eviction policy when size limit reached # Options: lru, fifo, size # Default: lru DISK_WARM_EVICTION_POLICY=lru # ============================================================================ # Storage Options # ============================================================================ # Enable compression (gzip) # Default: false COMPRESSION_ENABLED=true # Default TTL in milliseconds # Optional - if not set, data never expires # Example: 1209600000 = 14 days DEFAULT_TTL_MS=1209600000 # Promotion strategy: 'eager' or 'lazy' # eager: Automatically promote data to upper tiers on read # lazy: Only promote on explicit bootstrap or write # Default: lazy PROMOTION_STRATEGY=lazy # ============================================================================ # Bootstrap Configuration # ============================================================================ # Number of items to load into hot tier on bootstrap # Optional - if not set, loads all items BOOTSTRAP_HOT_LIMIT=1000 # Number of days to look back when bootstrapping warm tier # Example: 7 = only load items accessed in last 7 days BOOTSTRAP_WARM_DAYS=7 # Maximum items to load into warm tier on bootstrap # Optional - if not set, loads all matching items BOOTSTRAP_WARM_LIMIT=10000 # ============================================================================ # Performance Tuning # ============================================================================ # Maximum concurrent operations for bootstrap # Default: 10 BOOTSTRAP_CONCURRENCY=10 # Timeout for tier operations in milliseconds # Default: 30000 (30 seconds) TIER_OPERATION_TIMEOUT_MS=30000 # ============================================================================ # Monitoring & Observability # ============================================================================ # Enable statistics tracking # Default: true STATS_ENABLED=true # Log level: debug, info, warn, error # Default: info LOG_LEVEL=info