r/SpringBoot • u/Entire-Position9690 • May 06 '26
News Spring Idempotency Kit [1.0.0]
Spring Idempotency Kit is a production-ready library that ensures methods execute exactly once per unique key — preventing duplicate operations in distributed systems.
Problem it solves: Retries, timeouts, and concurrent requests cause duplicate executions. Double charges, repeated orders, webhook duplication. This library eliminates that.
All you do:
public PaymentResponse
The library handles:
- Redis-backed caching — first request executes, retries return cached result
- Distributed locking — concurrent duplicates are rejected or wait for the original to finish
- Failure strategies — fail-open (keep running) or fail-closed (503 if Redis is down)
- Built-in metrics — cache hits, conflicts, execution timing
- Zero boilerplate — Spring Boot auto-configuration, just annotate
How It Works
- Client sends a unique key (header or derived from request)
- Cache hit → return immediately
- Cache miss → acquire distributed lock, execute, store result
- Retry with same key → returns cached result
Requirements
- Java 21+
- Spring Boot 3.4+
- Redis
Links
Built by Atlancia Labs
57
Upvotes
View all comments
Show parent comment
1
u/Entire-Position9690 May 07 '26
Redis is not required. The library is built around the IdempotencyStorage interface. Redis is just the provided implementation.
You can plug in any backend by implementing those 4 methods.