1

I've read the following article about cache synchronization and database. Here the author uses JOOQ for cache synchronization.

https://vladmihalcea.com/cache-synchronization-jooq-postgresql-functions/

After reading the article I found that to know the database changes, we need to call the API manually. Is there any pattern to get real-time notifications of the database changes to the Java application like web socket push?

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
vvekselva
  • 803
  • 3
  • 17
  • 34

1 Answers1

0

The solution in the article is meant to be called every N seconds to synchronize the cache.

The Web Sockets push is more useful for the UI than for backend services. If you want to make this synchronously, you could use PostgreSQL NOTIFY.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
  • Hello Vlad, forgive me for bothering you directly: would you be able to help with this question: https://stackoverflow.com/questions/76666162/cache-them-all-with-hibernate ? So far nobody was able to provide any hints :( Many thanks!! – morgwai Jul 16 '23 at 23:27
  • awesome thanks!! enjoy your time off! :) – morgwai Jul 17 '23 at 09:14