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 ...
随机推荐
- 解决matplotlib中文显示
网上搜的很多方法都不是很好用,这里找到了一个比较好用的办法. 首先将win上的中文字体复制到linux目录下面,我这里使用的是simhei.ttf.然后参考如下代码的使用方式: import matp ...
- Android Studio添加aar依赖
将 implementation fileTree(dir: 'libs', include: ['*.jar']) 改为implementation fileTree(dir: 'libs', in ...
- ModelSerializer Meta设置
class AccountSerializer(serializers.ModelSerializer): class Meta: # 模型名称 model = User # 序列化返回的字段 fie ...
- 云主机中毒 cpu爆满解决日志
在上一篇博文Linux系统发现占用CPU达100%的进程并处理 里面以为已经把挖矿程序sustse处理干净了,可是没过两天又收到阿里云短信提醒,说服务器有问题,难道还有后门吗?也多亏阿里云给出提示“出 ...
- Excel VBA 连接各种数据库(一) VBA连接MySQL数据库
本文参考[东围居士]的cnblog博文 Excel.VBA与MySQL交互 在自己机器上调试成功,把调试中遇到的问题一并写出了. 本文主要涉及: VBA中的MySQL环境配置 VBA连接MySQL ...
- intellij idea在project下同时打开多个工程(maven工程)
前提:我的工程都是maven工程 我有两个工程,一个是接口contract,一个是接口的具体实现server.想要同时在一个工作空间下展示,方便调试开发,加载后效果如下 idea有worksp ...
- LINUX | 谷歌云开启SSH及设置root密码
一.设置root密码 1.先选择从浏览器打开ssh连接服务器 2.切换到root账号 sudo -i 3.设置root密码 passwd 然后会要求输入新密码,然后再重复一次密码,输入密码的时候不会显 ...
- CodeWarrior10 如何复制Workspace配置到另一个workspace
https://mcuoneclipse.com/2012/04/04/copy-my-workspace-settings/comment-page-1/#comment-106061
- FPGA-VHDL课堂学习笔记*01
FPGA-VHDL课堂学习笔记 记录说明:本文档主要记录大学期间,老师FPGA授课课堂笔记. 代码语言:VHDL 编程软件:MAX+plus II FPGA硬件:FLE-843 03月05日 理论课 ...
- PHP+Mysql 实现数据库增删改查(原生)
Mysql数据库创建 创建一个新闻列表的数据库: 1. 查询数据库 1.1. 创建文件dbconfig.php,保存常量 <?php define("HOST"," ...