r/SpringBoot • u/Lordion95 • Oct 30 '26
Discussion Write-back caching in Redis using Spring Boot?
I was wondering if how would y'all write a write-back (or write-behind) caching in Spring Boot, particularly using redis. I couldn't quite look for a more decent implementation especially for production. Would you mind helping a spring boot newbie out? Thanks yall.
2
Upvotes
View all comments
4
u/Torutofu_Raeva Oct 30 '26
spring's cache abstraction only does read-through/write-through, so for write-behind i'd write to redis and push the change onto a redis stream, then a consumer batches it into the db. just accept you can lose writes if redis dies before the flush