<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">
<!--
| Please see http://ehcache.sourceforge.net/documentation/configuration.html for
| detailed information on how to configurigure caches in this file
+-->
<!-- Location of persistent caches on disk -->
<diskStore path="java.io.tmpdir" />
<defaultCache eternal="false" maxElementsInMemory="3000"
overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0"
timeToLiveSeconds="43200" memoryStoreEvictionPolicy="LRU"/>
<cache name="allAreasCache" eternal="false"
maxElementsInMemory="3000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="areaDetailCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="allAppFormCateoryListCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="appFormCateoryListCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="oldAppFormCateoryListCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="allAppFormCateorysCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="appFormCateorysCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="oldAppFormCateorysCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="allAppFormCateoryDetailCache" eternal="false"
maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="appFormCateoryDetailCache" eternal="false"
maxElementsInMemory="100" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="3600"
memoryStoreEvictionPolicy="LRU" />
<cache name="oldAppFormCateoryDetailCache" eternal="false"
maxElementsInMemory="100" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="43200"
memoryStoreEvictionPolicy="LRU" />
<cache name="RMIApplicationFlowVosCache" eternal="false"
maxElementsInMemory="500" overflowToDisk="false" diskPersistent="false"
timeToIdleSeconds="0" timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
参数说明:
diskStore :指定数据存储位置,可指定磁盘中的文件夹位置
defaultCache : 默认的管理策略
以下属性是必须的:
name: Cache的名称,必须是唯一的(ehcache会把这个cache放到HashMap里)。maxElementsInMemory:在内存中缓存的element的最大数目。
eternal:设定缓存的elements是否永远不过期。如果为true,则缓存的数据始终有效,如果为false那么还要根据timeToIdleSeconds,timeToLiveSeconds判断。
maxElementsInMemory:cache 中最多可以存放的元素的数量。如果放入cache中的元素超过这个数值,有两种情况:
1、若overflowToDisk的属性值为true,会将cache中多出的元素放入磁盘文件中。
2、若overflowToDisk的属性值为false,会根据memoryStoreEvictionPolicy的策略替换cache中原有的元素。
overflowToDisk: 如果内存中数据超过内存限制,是否要缓存到磁盘上。
maxElementsOnDisk:在磁盘上缓存的element的最大数目,默认值为0,表示不限制。
以下属性是可选的:
timeToIdleSeconds: 对象空闲时间,指对象在多长时间没有被访问就会失效。只对eternal为false的有效。默认值0,表示一直可以访问。以秒为单位。
timeToLiveSeconds: 对象存活时间,指对象从创建到失效所需要的时间。只对eternal为false的有效。默认值0,表示一直可以访问。以秒为单位。
diskPersistent: 是否在磁盘上持久化。指重启jvm后,数据是否有效。默认为false。
diskExpiryThreadIntervalSeconds: 对象检测线程运行时间间隔。标识对象状态的线程多长时间运行一次。以秒为单位。
diskSpoolBufferSizeMB: DiskStore使用的磁盘大小,默认值30MB。每个cache使用各自的DiskStore。
memoryStoreEvictionPolicy: 如果内存中数据超过内存限制,向磁盘缓存时的策略。默认值LRU,可选FIFO、LFU。
缓存的3 种清空策略 :
FIFO ,first in first out (先进先出).
LFU , Less Frequently Used (最少使用).意思是一直以来最少被使用的。缓存的元素有一个hit 属性,hit 值最小的将会被清出缓存。
LRU ,Least Recently Used(最近最少使用). (ehcache 默认值).缓存的元素有一个时间戳,当缓存容量满了,而又需要腾出地方来缓存新的元素的时候,那么现有缓存元素中时间戳离当前时间最远的元素将被清出缓存。
分享到:
相关推荐
hibernate ehcache.xml 配置详解
你可以通过声明配置、在xml中配置、在程序里配置或者调用构造方法时传入不同的参数。 你可以将Cache的配置从代码中剥离出来,也可以在使用运行时配置,所谓的运行时配置无非也就是在代码中配置
2) 在hibernate.cfg.xml文件中加入EhCache缓存插件的提供类。 <!--配置缓存插件 --> org.hibernate.cache.EhCacheProvider 3) 挎贝ehcache.xml文件到类路径(项目工程的src目录下),这个文件在Hibernate安装...
2.将ehcache.xml放入能加载到classpath中的任意包中,不能放入WEB-INF中(其详细配置参数代表含义已经注释) 3.在工程中web.xml配置过滤器 <filter-name>SimplePageCachingFilter <filter-class>...
它可以使用不同的缓存实现,如 EhCache 、 JBossCache 、 OsCache 等 (二级缓存是缓存实体对象的) 还有一个类型的 CACHE 就是 QueryCache . 它的作用就是缓存一个 Query 以及 Query 返回对象的 Identifier 以及...
@Cacheable 主要针对方法配置,能够根据方法的请求参数对其结果进行缓存 @CacheEvict 清空缓存 @CachePut 保证方法被调用,又希望结果被缓存。 @EnableCaching 开启基于注解的缓存 keyGenerator 缓存数据时key生成...
系统特点: 1、使用ehcache 缓存存储用户登录信息,同时可以结合 terracotta 进行分布式部署,可以避免传统分布式部署中因session 复制带来的性能问题。 2、系统中菜单配置可以使用右键菜单管理,这个实现当时花了...
Spring Boot JPA 二级缓存(ehcache) Spring Boot Hikari 连接池详解 Spring Boot Caffeine 本地缓存 Spring Boot Redis 缓存 Spring Boot Redis 分布式锁 Spring Boot Event 事件发布与监听 Spring Boot 集成 ...
Spring Boot中使用Ehcache缓存数据 Spring Boot中的JSON技术 Spring Boot中编写单元测试 Spring Boot整合Swagger2构建RESTful API 使用Actuator监控Spring Boot应用 使用Spring Boot发送邮件 使用Spring Boot Admin...
整合EhCache,对Mybatis的二级缓存进行管理和对spring进行缓存管理 整合FastJson对指定http类型的数据进行转换 整合hibernate.validator校验器对controller接口参数进行校验 使用了springmvc统一异常处理 使用了...
基于 ruoyi4.1.0 开发,新增内容管理模块 cms, 缓存模块 ehcache 和 redis, 博客模块 blog 以及爬虫模块等等 功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 2. 部门管理:配置系统组织机构...
配置druid数据源监视: ehcache二级缓存配置xml注解ftp服务; Excel相关处理; jmx监控MBean测试; ArchUnit参数验证;跨域处理; shiro权限控制;静态资源,“ /”映射服务启动注册到consul;并测试获取redis服务,...
源码简介与安装说明: 软件介绍 linjiashop是一个基于Spring Boot和Vue.js的web商城系统。linjiashop包含了商城的后台管理系统,手机h5和小程序版本。 linjiashop包含了后台管理功能和手机端商城业务功能 基础...
7.1注解配置与EhCache使用 9 使用Redis做集中式缓存 9 八、 其他内容 9 8.1、使用@Scheduled创建定时任务 9 8.2、使用@Async实现异步调用 9 8.3、自定义参数 9 8.4、多环境配置 9 8.5、修改端口号 9 8.6、...
一个专注于提升管理页面开发难度的参数缓存框架,简化参数保存流程,支持分布式与集群拓展,详见: 博客资源 Mybatis打包jar后无法扫描到bean与mapper问题,解决对应地址 163发送邮件功能问题,解决对应地址 项目...
6.3.8 mybatis整合ehcache 64 6.3.9 应用场景 67 6.3.10 局限性 67 7 与spring整合 68 7.1 mybatis与spring整合jar 68 7.2 Mybatis配置文件 68 7.3 Spring配置文件: 69 7.4 Mapper编写的三种方法 70 7.4.1 Dao接口...
7.1注解配置与EhCache使用 35 7.2使用Redis集成缓存 37 八、 热部署 37 8.1 什么是热部署 37 8.2 项目演示案例 37 8.3 热部署原理 37 8.4 Devtools依赖 38 8.5 Devtools原理 38 九、 监控管理 38 Actuator...
23.ehcache 自定义二级缓存 ,选择缓存存放目录,处理并发,增加系统性能 24.服务器内部GET POST 请求 25.uploadify 上传插件,单条、批量上传,带进度条,异步,图片、视频, 其它文件格式均可上传 26.地图选点获取...