Springle+EHCache 分布式缓存开发(三)
来源:互联网 发布:数据恢复后照片打不开 编辑:程序博客网 时间:2024/06/03 15:57
1、配置缓存参数
完整的文件路径为:WebRoot/WEB-INF/service/conf/ehcache.xml
在缓存配置文件“/ehcache.xml”中配置每种缓存数据放在内存中的数量、时长以及缓存替换策略等属性。下面是“vpnServiceCache”缓存数据的属性:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<defaultCache maxElementsInMemory="500000" eternal="true"
overflowToDisk="false" memoryStoreEvictionPolicy="LFU" />
<cache name="serviceCache" maxElementsInMemory="1000000" eternal="true"
overflowToDisk="false" memoryStoreEvictionPolicy="LFU" />
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory" />
</ehcache>
配置项属性
name:配置缓存的名称,业务可以根据不同的业务命名,如*serviceCache,业务在此处可以配置多个缓存。
maxElementsInMemory:缓存中最大允许创建的对象数。这里建议配置为1000000。
eternal:缓存中的对象是否为永久的。如果是永久的,超时设置将被忽略,对象从不过期。这里建议配置为true。
overflowToDisk:内存不足时,是否启用磁盘缓存。这里建议配置为false。
配置项:cacheEventListenerFactory
配置缓存事件监听,当有多个应用为集群组网时,需要配置该配置项。
配置项属性
Class:配置缓存时间监听的类路径,类路径为:net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory
- Springle+EHCache 分布式缓存开发(三)
- Springle+EHCache 分布式缓存开发(一)
- Springle+EHCache 分布式缓存开发(二)
- Springle+EHCache 分布式缓存开发(四)
- Springle+EHCache 分布式缓存开发(五)
- Springle+EHCache 分布式缓存开发(六)
- Ehcache分布式缓存实例(集群环境)
- Ehcache 分布式缓存
- EHCACHE分布式缓存
- EhCache分布式缓存
- Ehcache分布式缓存
- EHCACHE分布式缓存
- Ehcache 分布式缓存 -springMVC
- Ehcache分布式缓存实现
- 分布式缓存--EhCache
- Ehcache 分布式缓存 -springMVC
- Ehcache 分布式缓存 -springMVC
- ehcache 分布式缓存
- SQL查询全年
- the first it security saas marketplace
- Jackrabbit OCM(二)——ObjectContentManager对象
- jackrabbit OCM(三)——映射应用1
- RegExp 对象
- Springle+EHCache 分布式缓存开发(三)
- Starting MySQL....The server quit without updating PID file 处理方法
- XML应用系列:XSLT入门
- Activity生命周期
- 数据库SQL自动执行脚本
- 抓取iframe内数据(C#)
- 数据库中聚簇索引与非聚簇索引的区别
- MyEclipse Sub Code Generator
- 在BSP 中修改LCD 类型及串口输出功能