1

We have a REST API built using Spring boot. Due to the complexity, the response time quite slow. To improve the performance, we identified set of static info that can be cached instead of going to DB every time.

The way I understand spring cache is, at first run it makes a DB call and then cache the info. When same set of input is given, it returns the result from cache. If the input params are different it goes to the DB again. Please correct me, if my understanding is wrong.

However, we want to cache set of tables (around 10) when server starts and use this info (if available in cache) before trigger a DB call for a given set of input params. Can this be achieved using spring's cache API?

alex
  • 21
  • 1
  • 5
  • Yes, it surely can be achieved. However, do show use some code what you have tried so far and may need some help for it. – Bond - Java Bond Jul 09 '21 at 12:09
  • If Hibernate is an option, I would also consider using its second level cache. – Matthias Jul 09 '21 at 12:24
  • I got it worked with custom cache implemented for my app. But spring doc helped me to come up with my own implementation. – alex Jul 15 '21 at 14:46

0 Answers0