1、默认的内存缓存:
该cache.ccf配置文件是放置到web-inf/classes/目录下的! 同时如果配置文件内没有指定特定的缓冲区的属性,所有缓冲区都会根据默认属性来构建。
jcs.default= jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.default.cacheattributes.MaxObjects=1000 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
在上面的配置中,MaxObject 指定缓冲区的大小是存放1000个对象,1000个缓冲对象是指的每个缓冲区的大小为存放1000个对象,而不是指所有的缓冲区总容量。 其中:
jcs.default=? 用来指定默认缓冲区对应的辅助缓冲区的名称!
cacheattributes :设定使用的 cache 属性管理类别
MemoryCacheName: 表示内存缓冲区使用LRUMemoryCache对象。
2、如果需要加上缓存有效期限制,需要加上如下内容 接着上面的配置文件按(if you want to add memory shrinking then you can add these lines ):
jcs.defalut.cacheattritues.UserMemoryShrinker=true jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600 jcs.default.cacheattributes.ShrinkerIntervalSeconds=60 jcs.default.MaxSpoolPerRun=500 jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes jcs.default.elementattributes.IsEternal=false
上面的配置 中:
UserMemoryShrinker 属性设定是否使用冗余内存清除程序,true表示是
MaxMemoryIdleTimeSeconds 属性:表示 将UserMemoryShrinker 设为true时,jcs对缓冲的对象的最大滞留缓存中的时间,如果一个对象在缓冲区内停留的时间操作这个时间,就会被认为是“不新鲜的”而不清理掉或者存 入磁盘 此次表示 3600秒则过期。
ShrinkIntervalSeconds 属性表示 对在缓存中的对象,多长时间检查一次,如果在检查的过程中发现有 驻留缓存大于 MaxMemoryIdleTimeSeconds 的,就将做过期处理。
Elementattributes 属性用来设定 element属性类别。
IsEternal 属性:用来设定 element 属性 是否会过期,(单词Eternal永久的意思) = false 表示不永久,就是会过期。
jcs.default.elementattributes.MaxLifeSeconds=2100 :设定 element 建立后能存活多久,IsEternal=false时有效
jcs.default.elementattributes.IdleTime=1800: 设定 element 可闲置的时间,IsEternal=false时有效
3.设置硬盘索引缓冲区(辅助缓冲区)
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFacory jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.dis.indexed.IndexedDiskCacheAttributes jcs.auxiliary.DC.attributes.DiskPath=g:/dev/jcs/raf
3、如果想将这个辅助硬盘索引缓冲区绑定到默认的缓冲区上,需要 修改默认缓冲区定义的第一条记录为
jcs.default =DC 即可,这样 所有未指定属性的缓冲区都会自己使用一个硬盘缓冲区,缓冲文件以缓冲区的名字来命名。存放到指定目录下。
4、如果想预定义一个具体的region缓冲区,比如叫做 testCache1,那么可以增加下面的配置:
jcs.region.testCache1=DC (此处指明辅助缓冲区,如果没有则说明没有辅助缓冲区) jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.region.testCache1.cacheattributes.MaxObjects=1000 jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600 jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60 jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500 jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes jcs.region.testCache1.elementattributes.IsEternal=false
5、完整的 配置文件如下(来自官方英文版pdf,加了点注释):
# DEFAULT CACHE REGION (默认缓冲区)
jcs.default=DC,LTCP -- 指明辅助缓冲区
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
# PRE-DEFINED CACHE REGIONS (预定义的region缓冲区(不是默认的,可以通过名称获取名称是 testCache1))
jcs.region.testCache1=DC,LTCP
jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.testCache1.cacheattributes.MaxObjects=1000
jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.testCache1.elementattributes.IsEternal=false
# AVAILABLE AUXILIARY CACHES (硬盘索引辅助缓冲区和横向式的并行缓冲LTCP)
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=g:/dev/jcs/raf
jcs.auxiliary.DC.attributes.maxKeySize=100000
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
相关推荐
JCS缓存所需jar
● 完全可配置的运行时参数 ● 局部数据分割和配置 ● 纤细粒度的元素配置选项 ● 远程同步 ● 远程存储恢复 ● 非阻塞 "zombie" (balking facade(等待外观)) 模式 ● 横向的元素分发...
● 完全可配置的运行时参数 ● 局部数据分割和配置 ● 纤细粒度的元素配置选项 ● 远程同步 ● 远程存储恢复 ● 非阻塞 "zombie" (balking facade(等待外观)) 模式 ● 横向的元素分发...
JCS缓存入门及简介
jcs缓存所需要的包。导入这两个包即可使用jcs缓存策略
jcs-1.3资源包下载,没什么可描述的, 自己下载看吧
简单的jcs实例,需要一些jar包,对于占用大量内存的代码可以考虑用jcs.
jcs 所需的三个jar包 还没来得及测试
JCS在一般用在,查询数据库比较频繁,每次查询的结果都差不多,这样讲数据进行缓冲,可以 减轻数据库负担: 下面举个例子: 在一个点击量比较频繁的页面,调用一个数据列表,每个用户进去在某一时间段数据都一样,...
commons-jcs针对web开发缓存处理
佳灵JCS高压变频器彩色样本PDF版pdf,佳灵JCS高压变频器彩色样本PDF版
昆仑海岸 JCS大量程系列超声波物位变送器使用说明书PDF,昆仑海岸 JCS大量程系列超声波物位变送器使用说明书
资源分类:Python库 所属语言:Python 资源全名:jcson-0.1.1-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
JCS-018立时加工中心主轴箱及(sw+说明书+cad).rar
今天看到csdn 上的一个哥们,将这个资源的资源分设为10,从另外的地方找了一份,特上传与大家分享。
What jars are required by JCS? As of verison 1.2.7.0, the core of JCS (the LRU memory cache, the indexed disk cache, the TCP lateral, and the RMI remote server) requires only two other jars. ...
JCS-018立时加工中心主轴箱及(sw+说明书+cad)cad图纸毕业生设计书.zip
(Java Caching System)基于数据库的WEB应用程序加上缓存,以提高性能
NULL 博文链接:https://phl.iteye.com/blog/2240901
昆仑海岸 JCS-10系列超声波物位变送器使用说明书PDF,昆仑海岸 JCS-10系列超声波物位变送器使用说明书