日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

在Mybatis中使用自定義緩存ehcache

作者:weixin_44953227 更新時間: 2022-04-09 編程語言

自定義緩存 - ehcache

Ehcache是一種廣泛使用的開源Java分布式緩存。主要面向通用緩存,Java EE和輕量級容器

  1. 導包

<dependency>
    <groupId>org.mybatis.cachesgroupId>
    <artifactId>mybatis-ehcacheartifactId>
    <version>1.1.0version>
dependency>
  1. 在 Mapper.xml 中指定使用 ehcache 緩存實現

<cache type="org.mybatis.caches.ehcache.EhcacheCache"/>
  1. 在resource中定義配置文件 ehcache.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">

    

    
    <diskStore path="./tempdir/Tmp_Ehcache"/>

    
    <defaultCache
        eternal="false"
        maxElementsInMemory="10000"
        overflowToDisk="false"
        diskPersistent="false"
        timeToIdleSeconds="1800"
        timeToLiveSeconds="259200"
        memoryStoreEvictionPolicy="LRU"/>
    
    <cache
        name="cloud_user"
        eternal="false"
        maxElementsInMemory="5000"
        overflowToDisk="false"
        diskPersistent="false"
        timeToIdleSeconds="1800"
        timeToLiveSeconds="1800"
        memoryStoreEvictionPolicy="LRU"/>

    
ehcache>

原文鏈接:https://blog.csdn.net/weixin_44953227/article/details/112801107

欄目分類
最近更新