Files
bun.sh/src/bun.js/api
Claude Bot 4187cef4b9 Add compression cache configuration with --smol mode support
Implemented cache control API:
- cache: false - Disables caching entirely (compress on-demand, not cached)
- cache: { maxSize, ttl, minEntrySize, maxEntrySize } - Configure limits
- --smol mode automatically uses conservative defaults

Cache Configuration:
- DEFAULT: 50MB max, 24h TTL, 128B-10MB per entry
- SMOL: 5MB max, 1h TTL, 512B-1MB per entry (for --smol flag)
- cache: false - Skip caching, return false from tryServeCompressed()

API Example:
```js
Bun.serve({
  compression: {
    brotli: 6,
    cache: false, // Disable caching
    cache: {
      maxSize: 100 * 1024 * 1024, // 100MB
      ttl: 3600, // 1 hour (seconds)
      minEntrySize: 512,
      maxEntrySize: 5 * 1024 * 1024,
    }
  }
})
```

Limitations (TODO):
- Cache limits are parsed but not enforced yet
- No TTL checking or eviction
- No total size tracking or LRU eviction
- cache: false works immediately

The configuration exists and --smol defaults are in place, ready for
enforcement implementation later.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 12:46:55 +00:00
..
2025-06-12 14:20:28 -07:00