How I made a powerful cache system using Go
summary
Built a Go HTTP cache called Souin that plugs into Traefik and Caddy, backed by multiple storages (badger, filesystem, Redis and others) and deployed via Docker Hub and GoReleaser. It uses goroutines, channels, context and interfaces, implements request coalescing with singleflight, supports ESI fragments and RFC cache-group invalidation, and claims lower latency than Varnish (example: 40 concurrent clients get a single upstream fetch). Tests run with race detector, Newman end-to-end, and CI linting.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 1:27Custom HTTP cache system
- 2:52Go’s goroutines and channels
- 6:09Flexible storage backends
- 8:19Go’s context system
- 9:46YAML configuration in Go
- 11:33Swan plugin with reverse proxies
- 13:23Middleware for caching
- 16:35Request coalescing
- 18:19Cache management API
- 19:43Storage backends
- 20:26Cache groups and invalidation
- 21:50Edge Side Includes caching
- 26:06HTTP cache RFCs
- 27:54Cache status headers
- 29:25CDN cache control
- 31:10Testing and deployment
- 33:39Swan cache future plans
- 34:44Q&A
related talks
37mGo learning by project: Souin (rex)
37mHow I made a powerful cache system using Go
40mBuilding a Highly Concurrent Cache in Go: A Hitchhiker's Guide
25mBuild and Test Caching in Go
56mCaching the uncacheable in Varnish
42mCaching for Cash
46mSimplifying Scalable Cloud Application Development with Go
30mCaching patterns for lazy devs for lazy loading
