在Mybatis中使用自定义缓存ehcache的方法

网友投稿 549 2023-02-18

在Mybatis中使用自定义缓存ehcache的方法

在Mybatis中使用自定义缓存ehcache的方法

自定义缓存 - ehcache

Ehcache是一种广泛使用的开源java分布式缓存。主要面向通用缓存,Java EE和轻量级容器

1.导包

<!http://-- https://mvnrepository.com/artifact/org.mybatis.caches/mybatis-ehcache -->

org.mybatis.caches

mybatis-ehcache

1.1.0

2.在 Mapper.xml 中指定使用 ehcache 缓存实现

3.在resource中定义配置文件 ehcache.xml

xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">

http://

<!--default 默认缓冲策略, 当ehcache找不到定义的缓存时, 则使用这个缓存策略, 这个只能定义一个-->

&AxHSHPflt;defaultCache

eternal="false"

maxElementsInMemory="10000"

overflowToDisk="false"

diskPersistent="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="259200"

memoryStoreEvictionPolicy="LRU"/>

name="cloud_user"

eternal="false"

maxElementsInMemory="5000"

overflowToDisk="false"

diskPersistent="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="1800"

memoryStoreEvictionPolicy="LRU"/>

xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">

http://

<!--default 默认缓冲策略, 当ehcache找不到定义的缓存时, 则使用这个缓存策略, 这个只能定义一个-->

&AxHSHPflt;defaultCache

eternal="false"

maxElementsInMemory="10000"

overflowToDisk="false"

diskPersistent="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="259200"

memoryStoreEvictionPolicy="LRU"/>

name="cloud_user"

eternal="false"

maxElementsInMemory="5000"

overflowToDisk="false"

diskPersistent="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="1800"

memoryStoreEvictionPolicy="LRU"/>

name="cloud_user"

eternal="false"

maxElementsInMemory="5000"

overflowToDisk="false"

diskPersistent="false"

timeToIdleSeconds="1800"

timeToLiveSeconds="1800"

memoryStoreEvictionPolicy="LRU"/>

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:移动应用开发学什么(移动应用开发专业怎么样)
下一篇:基于Spring AOP @AspectJ进阶说明
相关文章

 发表评论

暂时没有评论,来抢沙发吧~