1、cache.memory
是否使用内存缓存;值为:true或false。默认为true;如设置为false,那cache只能缓存到数据库或硬盘中。
2、cache.capacity
缓存的最大数量。默认是不限制,cache不会移走任何缓存内容。负数被视不限制。
3、cache.algorithm
运算规则。为了使用规则,cache的size必须是指定的。
如果cache的size不指定的话, 将不会限制缓存对象的大小。如果指定了cache的size,但不指定algorithm,那它会默认使用:com.opensymphony.oscache.base.algorithm.LRUCache
有下面三种规则:
com.opensymphony.oscache.base.algorithm.LRUCache: last in first out(最后插入的最先调用)。默认选项。
com.opensymphony.oscache.base.algorithm.FIFOCache: first int first out(最先插入的最先调用)。
com.opensymphony.oscache.base.algorithm.UnlimitedCache: cache中的内容将永远不会被丢弃。如果cache.capacity不指定值的话,它将被设为默认选项。
4、cache.blocking
是否同步。true或者false。一般设为true,避免读取脏数据。
5、cache.unlimited.disk
指定硬盘缓存是否要作限制。默认值为false。false的状况下,disk cache capacity和cache.capacity的值相同。
6、cache.persistence.class
指定类是被持久化缓存的类。class必须实现PersistenceListener接口。
作为硬盘持久,可以实现com.opensymphony.oscache.plugins.diskpersistence.HashDiskPersistenceListener接口。
它把class的toString()输出的hash值作为文件的名称。如果你要想文件名易读些(自己设定),DiskPersistenceListener的父类也能使用,但其可能有非法字符或者过长的名字。
注意:HashDiskPersistenceListener和DiskPersistenceListener需要设定硬盘路径:cache.path
7、cache.path
指定硬盘缓存的路径。目录如果不存在将被建立。同时注意oscache应该要有权限写文件系统。
例:
cache.path=c:\\myapp\\cache
cache.path=/opt/myapp/cache
8、cache.persistence.overflow.only (NEW! Since 2.1)
指定是否只有在内存不足的情况下才使用硬盘缓存。
默认值false。但推荐是true如果内存cache被允许的话。这个属性彻底的改变了cache的行为,使得persisted cache和memory是完全不同。
9、cache.event.listeners
class名列表(用逗号隔开)。每个class必须实现以下接口中的一个或者几个。
CacheEntryEventListener:接收cache add/update/flush and remove事件
CacheMapAccessEventListener :接收cache访问事件。这个可以让你跟踪cache怎么工作。
默认是不配置任何class的。当然你可以使用一下class:
com.opensymphony.oscache.plugins.clustersupport.BroadcastingCacheEventListener: 分布式的监听器。可以广播到局域网内的其他cache实例。
com.opensymphony.oscache.extra.CacheEntryEventListenerImpl:一个简单的监听器。在cache的生命周期中记录所有entry的事件。
com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl: 记录count of cache map events(cache hits,misses and state hits).
10、cache.key
在application和session的作用域时,用于标识cache对象的,用于ServletCacheAdministrator;此属性不是指定为"__oscache_cache"格式时为默认值, 如果代码中需要用到默认值时可以通使用com.opensymphony.oscache.base.Const.DEFAULT_CACHE_KEY来取得;
11、cache.use.host.domain.in.key
当配置多个服务器时,想通过服备器名称自动生成cache key时,可将此属性设为true. 默认值为false;
12、Additional Properties
在以上基础选项之上可以加入一些额外的属性到此文件中.
例: JavaGroupsBroadcastingListener便是额外的.
13、cache.cluster.multicast.ip
用于缓存集群. 默认为231.12.21.132
14、cache.cluster.properties
指集群中的额外配置项.
分享到:
相关推荐
oscache.properties oscache.properties oscache.properties oscache.properties
oscache.tld oscache.tld oscache.tld
osCache.rarosCache.rarosCache.rarosCache.rarosCache.rar
本文叙述了如何使用oscanche,最后的配置需要在oscache.properties中完成
OSCache标记库由OpenSymphony设计,它是一种开创性的缓存方案,它提供了在现有JSP页面之内实现内存缓存的功能。OSCache是个一个被广泛采用的高性能的J2EE缓存框架,OSCache还能应用于任何Java应用程序的普通的缓存...
oscache.ppt
oscache-2.3.jar
oscache-2.1.jar oscache-2.1.jar
描述了oscahce在JAVA开发中的应用和配置说明
oscache.properties 博文链接:https://xdjava.iteye.com/blog/1040936
oscache.tld,oscahe.properties,oscache-2.1.jar,commons
oscache-2.4.1.jar资源包,用于java缓存、jsp页面缓存
java所用,oscache(缓存),敬请下载。
OSCACHE网页缓存.ppt ,页面cache
OSCACHE的集群测试例子。。实现多个节点的集群与广播
springmvc最全的配置文件资料,springMVC包含json、xml、文件下载、静态资源配置、日志拦截器、freeMarker、错误日志、国际化等各种配置
Hibernate OSCache缓存 Hibernate OSCache缓存
最全的配置文件资料,springMvc包含josn、xml、文件下载、静态资源配置、日志拦截器、freeMarker、错误日志、国际化等各种配置
import com.opensymphony.oscache.general.GeneralCacheAdministrator; public class BaseCache extends GeneralCacheAdministrator { //过期时间(单位为秒); private int refreshPeriod; //关键字前缀字符...