r/microservices • u/OtherwisePush6424 • 11h ago
Tool/Product Cross-process cache stampede protection for the cache you already use.
https://github.com/gkoos/crossflightA small Node library for preventing cache stampedes across processes.
If multiple app instances miss the same cache key at the same time, they can all trigger the same expensive load at once. Crossflight adds a separate distributed coordination layer so only one process owns the in-flight load, writes the result, and lets the rest wait for the same value instead of re-running the loader.
The project is intentionally decoupled from the storage layer: it wraps the cache you already use, and keeps coordination separate. The built-in adapters currently cover:
- cache-manager
- Keyv
- Cacheable
A cache-manager-backed cache can be paired with Memcached for values and Redis for coordination, or any other combination that satisfies the adapter/coordinator interfaces. The current built-in coordinator is Redis.
This is useful for services where you want to reduce duplicate DB/API work without forcing a big cache migration.