1.pom.xml文件配置(主要针对jar包的引入)

<ehcache.version>2.6.9</ehcache.version>
<ehcache-web.version>2.0.4</ehcache-web.version>
<!-- CACHE begin -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-web</artifactId>
<version>${ehcache-web.version}</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.5.1</version>
</dependency>
<!-- CACHE end --> 2.spring-context.xml
<!-- 缓存配置 -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:${ehcache.configFile}" />
</bean>

  

3.jeesite.properties

4.ehcache-rmi.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false" name="defaultCache">
<!-- <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=manual, socketTimeoutMillis=2000,
rmiUrls=//localhost:40001/defaultCache" /> <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="hostName=localhost,
port=40000, socketTimeoutMillis=2000"/> --> <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic,multicastGroupAddress=230.0.0.1,multicastGroupPort=4446,timeToLive=1,hostName=localhost" />
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=localhost,port=40001" /> <diskStore path="../temp/qbkj/ehcache" />

<!--
diskStore path:用来配置磁盘缓存使用的物理路径
name: 缓存名称,cache的唯一标识(ehcache会把这个cache放到HashMap里)
eternal="false" 元素是否永恒,如果是就永不过期(必须设置)
maxElementsOnDisk====磁盘缓存中最多可以存放的元素数量,0表示无穷大
maxElementsInMemory="1000" 内存缓存中最多可以存放的元素数量(必须设置)
timeToIdleSeconds="0" 导致元素过期的访问间隔(秒为单位). 0表示可以永远空闲,默认为0
timeToLiveSeconds="600" 元素在缓存里存在的时间(秒为单位). 0 表示永远存在不过期
overflowToDisk="false" 当缓存达到maxElementsInMemory值是,是否允许溢出到磁盘(必须设置)
diskPersistent="false" 磁盘缓存在VM重新启动时是否保持(默认为false)
diskExpiryThreadIntervalSeconds="100" 磁盘失效线程运行时间间隔,默认是120秒
memoryStoreEvictionPolicy="LFU" 内存存储与释放策略.当达到maxElementsInMemory时
共有三种策略,分别为LRU(最近最少使用)、LFU(最常用的)、FIFO(先进先出)默认使用"最近使用"策略
-->

   <!-- 默认缓存配置. -->
<defaultCache maxEntriesLocalHeap="100" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true"
maxEntriesLocalDisk="100000" /> <!-- 系统缓存 -->
<cache name="sysCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" />
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</cache> <!-- 用户缓存 -->
<cache name="userCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true" /> <!-- 工作流模块缓存 -->
<cache name="actCache" maxEntriesLocalHeap="100" eternal="true" overflowToDisk="true" /> <!-- toke缓存 -->
<cache name="tokenCache" maxEntriesLocalHeap="20" eternal="false" timeToLiveSeconds="7000" diskSpoolBufferSizeMB="2" overflowToDisk="true" />
<!-- 签字缓存 -->
<cache name="signCache" maxEntriesLocalHeap="0" eternal="false" timeToLiveSeconds="3600" diskSpoolBufferSizeMB="100" overflowToDisk="true" />
<!-- 冷链缓存 -->
<cache name="coldCache" maxEntriesLocalHeap="0" eternal="false" timeToLiveSeconds="300" diskSpoolBufferSizeMB="100" overflowToDisk="true" />
<!-- 系统活动会话缓存 -->
<cache name="activeSessionsCache" maxEntriesLocalHeap="10000" overflowToDisk="true" eternal="true" timeToLiveSeconds="0" timeToIdleSeconds="0"
diskPersistent="true" diskExpiryThreadIntervalSeconds="600" /> </ehcache>
												

ehcache如何配置的更多相关文章

  1. (转)springMVC+mybatis+ehcache详细配置

    一. Mybatis+Ehcache配置 为了提高MyBatis的性能,有时候我们需要加入缓存支持,目前用的比较多的缓存莫过于ehcache缓存了,ehcache性能强大,而且位各种应用都提供了解决方 ...

  2. ehcache.xml配置参数

    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLoc ...

  3. hibernate二级缓存ehcache hibernate配置详解

    <!-----------------hibernate二级缓存ehcache------------------------->hibernate配置 <prop key=&quo ...

  4. spring中ehcache的配置和使用方法

    继续上篇,这篇介绍服务层缓存,ehcache一般的配置和用法 一.添加jar包引用 修改pom.xml文件,加入: <dependency> <groupId>org.spri ...

  5. SpringBoot中整合Redis、Ehcache使用配置切换 并且整合到Shiro中

    在SpringBoot中Shiro缓存使用Redis.Ehcache实现的两种方式实例 SpringBoot 中配置redis作为session 缓存器. 让shiro引用 本文是建立在你是使用这sh ...

  6. EhCache的配置

    JPA和Hibernate的二级缓存都是这样做的 代码目录: 这是基础的jar包,如果少的话,再去maven下载 <!-- Spring --> <dependency> &l ...

  7. Ehcache缓存配置

    Cache的配置很灵活,官方提供的Cache配置方式有好几种.你可以通过声明配置.在xml中配置.在程序里配置或者调用构造方法时传入不同的参数. 你可以将Cache的配置从代码中剥离出来,也可以在使用 ...

  8. Hibernate学习笔记之EHCache的配置

    Hibernate默认二级缓存是不启动的,启动二级缓存(以EHCache为例)需要以下步骤: 1.添加相关的包: Ehcache.jar和commons-logging.jar,如果hibernate ...

  9. ehcache 的配置

    配置:一.在src目录下加入ehcache.xml: <cache name="SimplePageCachingFilter" maxElementsInMemory=&q ...

  10. 02_MyBatis项目结构,所需jar包,ehcache.xml配置,log4j.properties,sqlMapConfig.xml配置,SqlMapGenerator.xml配置

     项目结构(所需jar包,配置文件) sqlMapConfig.xml的配置内容如下: <?xmlversion="1.0"encoding="UTF-8&qu ...

随机推荐

  1. 无分类编址(CIDR,Class Inter-Domain-Routing)

    CIDR全称是无分类域间路由选择,英文全称是Classless Inter-Domain Routing,大家多称之为无分类编址 CIDR的特点 (1)CIDR消除了传统的A类.B类和C类地址以及划分 ...

  2. 富文本编辑器 CKeditor 配置使用 (带附件)

    Ckeditor下载地址:http://ckeditor.com/download 1.CKeditor的基本配置 var textval=CKEDITOR.instances.TextArea1.g ...

  3. 输入一段字符串,统计其中的数字,字母,空格,其他字符的方法 ----python---

    1.以简单的循环分支实现字符统计 str1 = input("输入字符串:") num=0;word=0;space=0;other=0; for i in str1: if i. ...

  4. “AS3.0高级动画编程”学习:第二章转向行为(上)

    因为这一章的内容基本上都是涉及向量的,先来一个2D向量类:Vector2D.as (再次强烈建议不熟悉向量运算的童鞋,先回去恶补一下高等数学-07章空间解释几何与向量代数.pdf) 原作者:菩提树下的 ...

  5. OOP的五大原则

    一:单一职责原则. 含义一方面是避免相同的职责分散到不同的类中:另一方面避免一个类承担太多职责. 二:接口隔离原则. 一个类对另一个类的依赖性应当建立在最小的接口上的. 就是定制化服务设计的原则. 三 ...

  6. 修改Windows server 时间同步

    1.关闭“与Internet时间同步”选项. 2.禁用Windows时间服务,并将其设置为手动. 3.禁用Hyper-v时间同步服务,并将其设置为手动,这个在Hyper-v软件上选中要修改的虚拟机,设 ...

  7. keepalived vip 没有生成或者生成了ping不通?

    1 问题现象:keepalived已启动但vip 没有生成./var/log/messages日志不断刷屏 tail /var/log/messages Nov :: cache-redis- Kee ...

  8. POJ-3159.Candies.(差分约束 + Spfa)

    Candies Time Limit: 1500MS   Memory Limit: 131072K Total Submissions: 40407   Accepted: 11367 Descri ...

  9. 19-04【mysql】transaction,autocommit

    本地使用mysql测试结果如下, 没有使用start transaction的情况下: 如果set autocommit=1,则每一条语句默认提交: 如果set autocommit=0,则这条语句默 ...

  10. Maven解决NoPluginFoundForPrefixException错误

    Maven解决NoPluginFoundForPrefixException错误方法 错误出现的原因 你指的是一个不存在的插件,如由于错误的前缀. 您使用的是第三方的Maven插件没有部署到中央Mav ...