14.2.3.2 applicability of level 2 Cache
Hibernate's second-level cache can be configured when used as a pluggable component, but not all objects are suitable for second-level cache.
Generally, data with the following features is put into the second-level cache:
● Rarely modified data.
● Not very important data, allowing occasional concurrent data.
● Data that will not be accessed concurrently.
● Reference data.
Data with the following features is not suitable for the second-level cache:
● Frequently modified data.
● No concurrency is allowed for financial data.
● Data shared with other applications.
Note that there cannot be any third-party application that changes the data that is stored in the cache (this also includes using other methods to modify the data in your own program, for example, JDBC), because hibernate will not know that the data has been modified, so it cannot guarantee the consistency between the cached data and the data in the database.
Applicability of level 2 Cache