ehcache如何配置
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如何配置的更多相关文章
- (转)springMVC+mybatis+ehcache详细配置
一. Mybatis+Ehcache配置 为了提高MyBatis的性能,有时候我们需要加入缓存支持,目前用的比较多的缓存莫过于ehcache缓存了,ehcache性能强大,而且位各种应用都提供了解决方 ...
- ehcache.xml配置参数
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLoc ...
- hibernate二级缓存ehcache hibernate配置详解
<!-----------------hibernate二级缓存ehcache------------------------->hibernate配置 <prop key=&quo ...
- spring中ehcache的配置和使用方法
继续上篇,这篇介绍服务层缓存,ehcache一般的配置和用法 一.添加jar包引用 修改pom.xml文件,加入: <dependency> <groupId>org.spri ...
- SpringBoot中整合Redis、Ehcache使用配置切换 并且整合到Shiro中
在SpringBoot中Shiro缓存使用Redis.Ehcache实现的两种方式实例 SpringBoot 中配置redis作为session 缓存器. 让shiro引用 本文是建立在你是使用这sh ...
- EhCache的配置
JPA和Hibernate的二级缓存都是这样做的 代码目录: 这是基础的jar包,如果少的话,再去maven下载 <!-- Spring --> <dependency> &l ...
- Ehcache缓存配置
Cache的配置很灵活,官方提供的Cache配置方式有好几种.你可以通过声明配置.在xml中配置.在程序里配置或者调用构造方法时传入不同的参数. 你可以将Cache的配置从代码中剥离出来,也可以在使用 ...
- Hibernate学习笔记之EHCache的配置
Hibernate默认二级缓存是不启动的,启动二级缓存(以EHCache为例)需要以下步骤: 1.添加相关的包: Ehcache.jar和commons-logging.jar,如果hibernate ...
- ehcache 的配置
配置:一.在src目录下加入ehcache.xml: <cache name="SimplePageCachingFilter" maxElementsInMemory=&q ...
- 02_MyBatis项目结构,所需jar包,ehcache.xml配置,log4j.properties,sqlMapConfig.xml配置,SqlMapGenerator.xml配置
项目结构(所需jar包,配置文件) sqlMapConfig.xml的配置内容如下: <?xmlversion="1.0"encoding="UTF-8&qu ...
随机推荐
- Linux网络编程学习(七) ----- 有名管道(第四章)
1.什么是有名管道?为什么有了管道还需要有名管道? 有名管道是解决管道不能提供非父子进程间通信的缺陷.管道在Linux系统内部是以文件节点(inode)的形式存在,但由于其对外的不可见性(“无名”性) ...
- Loadrunner Vugen参数列表中数据分配方法及更新值的时间9种组合说明及验证
作为刚开始学习Loadrunner的新人,Data Assignment Method以及Update Method在相互组合之后,LR如何进行取值让我很是头疼. 于是花了一个晚上的时间认真学习官方文 ...
- list.sort和内置方法sorted的区别
1.list.sort会直接修改list,不会把原来的列表复制一份,直接修改list,所以list.sort的返回值为None; 2.sorted(list)的返回值就修改之后的list,原来的lis ...
- springCloud面试题
1.SpringCloud和Dubbo SpringCloud和Dubbo都是现在主流的微服务架构SpringCloud是Apache旗下的Spring体系下的微服务解决方案Dubbo是阿里系的分布式 ...
- Linux中 ./configure --prefix命令
源码的安装一般由3个步骤组成:配置(configure).编译(make).安装(make install),具体的安装方法一般作者都会给出文档,这里主要讨论配置(configure).Configu ...
- C语言基础01
1. 用scanf清理缓冲区数据 scanf("%*[^\n]"); scanf("%*c"); 2. 格式转换 将无符号整型数value转换成字符串并返回该字 ...
- python的apidoc使用
一.apidoc的安装 npm install apidoc -g -g参数表示全局安装,这样在哪儿都能使用. 二.apidoc在python接口代码中的使用 def index(): "& ...
- JVM学习03:性能监控工具
JVM学习03:性能监控工具 写在前面:本系列分享主要参考资料是 周志明老师的<深入理解Java虚拟机>第二版. 性能监控工具知识要点Xmind梳理 案例分析 案例分析1-JPS 案例分 ...
- JVM性能优化读后笔记
java性能优化权威指南读后笔记 三重境界 1.花似雾中看:对于遇到的额问题还看不清,不知道真真假假,是是非非. 2.悠然见南山:虽然刚开始对这个领域还不清楚,但随着时间推移,你对它有许多自己的见解, ...
- HDU 1522 Marriage is Stable 稳定婚姻匹配
http://acm.hdu.edu.cn/showproblem.php?pid=1522 #include<bits/stdc++.h> #define INF 0x3f3f3f3f ...