MyBatis之cache缓存配置

本文详细介绍了几种常见的缓存淘汰策略,包括LRU(最近最少使用)、FIFO(先进先出)、SOFT(软引用)及WEAK(弱引用)。这些策略在不同场景下有着各自的应用优势。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. <cache eviction="FIFO" flushInterval="86400000" size="1000" readOnly="true"/>

  2. <select resultMap="location_result" parameterType="java.util.Map" id="list" flushCache="false" useCache="true">

  3. <insert parameterType="Location" id="add" flushCache="true">

  1. LRU – Least Recently Used: Removes objects that haven't been used for the longst period of time.

  2. FIFO – First In First Out: Removes objects in the order that they entered the cache.

  3. SOFT – Soft Reference: Removes objects based on the garbage collector state and the rules of Soft References.

  4. WEAK – Weak Reference: More aggressively removes objects based on the garbage collector state and rules of Weak References.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值