Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of caching in Mybatis

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "sample Analysis of caching in Mybatis", which is easy to understand and well organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "sample Analysis of caching in Mybatis".

The primary and secondary caches of Mybatis.

1) first-level cache: PerpetualCache-based HashMap local cache, whose storage scope is Session. After Session flush or close, all Cache in the Session will be cleared, and first-level cache will be turned on by default.

2) the mechanism of the second-level cache is the same as that of the first-level cache, except that the storage scope is Mapper (Namespace) and the storage source can be customized, such as Ehcache. The second-level cache is not enabled by default. To enable the second-level cache, you need to implement the Serializable serialization interface (which can be used to save the state of the object) to use the secondary cache property class, which can be configured in its mapping file.

3) for the cache data update mechanism, when the C/U/D operation is performed in a certain scope (first-level cache Session/-second-level cache Namespaces), by default all caches in the select under that scope will be clear.

The above is all the content of the article "sample Analysis cached in Mybatis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report