In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the Hibernate secondary cache". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to solve the Hibernate secondary cache.
1. The general process of Hibernate second-level cache policy is as follows:
1. When a conditional query is made, a select * from table_name where is always issued. . (select all fields) SQL statements like this query the database and get all the data objects at once.
two。 Put all the acquired data objects into the second-level cache according to ID.
3. When Hibernate accesses data objects according to ID, it first looks it up from the first-level cache of Session; if not, if the second-level cache is configured, then look it up from the second-level cache; if not, query the database and put the results into the cache according to ID.
4. Update the cache as you delete, update, and add data.
Hibernate two-level caching strategy is a caching strategy for ID queries, but has no effect on conditional queries. To do this, Hibernate provides Query Cache for conditional queries.
two。 What kind of data is suitable to be stored in the Hibernate secondary cache?
1 data that is rarely modified
2 data that is not very important, allowing occasional concurrent data
3 data that will not be accessed concurrently
4 reference data refers to the constant data for application reference, the number of its instances is limited, its instances will be referenced by many other class instances, and the instances are rarely or never modified.
three。 Data that is not suitable for storage in the second level cache?
1 data that is often modified
2 Financial data, concurrency is absolutely not allowed.
3 data shared with other applications.
Thank you for your reading, the above is the content of "how to solve Hibernate secondary cache". After the study of this article, I believe you have a deeper understanding of how to solve the problem of Hibernate secondary cache, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.