Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you always use a second-level cache in Hibernate?

Tags:

hibernate

Do you always use a second-level cache in Hibernate or do you first try it without and only use it when the performance goes down?

like image 410
cretzel Avatar asked Dec 07 '22 09:12

cretzel


2 Answers

Make it work first, then make it fast. If you don't need caching, don't implement it.

like image 56
jon077 Avatar answered Dec 22 '22 06:12

jon077


In the applications where I've been, the database is shared among several applications, some of them are not Java at all. So, the second-level cache is not an option for me in these situations, because I never know when some other app can update the db.

like image 35
Miguel Ping Avatar answered Dec 22 '22 08:12

Miguel Ping