I need to refresh my Redis cache every time some insert/update happens in the DB through a flyway migration script. Is there any way to achieve this? My application is written in Spring Boot.
Asked
Active
Viewed 181 times
0
-
Is the update done using the same application or another application ? – Akbarhussain Patel Sep 26 '22 at 16:25
-
Cache is external – Shamil Puthukkot Sep 26 '22 at 16:45
1 Answers
0
You can use help of cacheManager
.
public void clearCache() {
cacheManager.getCacheNames()
.parallelStream()
.forEach(n -> cacheManager.getCache(n).clear());
}
Also check for documentation.

muhammed ozbilici
- 667
- 6
- 17
-
How do i trigger this when a flyway migration occur? I am looking for a way to connect migration script execution and cache clear method – Shamil Puthukkot Sep 27 '22 at 02:12