oscache.properties文件配置
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文件配置的更多相关文章
- 1. Spring基于xml加载和读取properties文件配置
在src目录下,新建test.properties配置文件,内容如下 name=root password=123456 logArchiveCron=0/5 * * * * ? 一种是使用sprin ...
- log4j用properties文件配置,无法应用过滤器的解决方法
properties文件仍然有错误 log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.L ...
- spring 配置文件中使用properties文件 配置
配置Bean载入properties文件: <bean id="propertyPlaceholderConfigurer" class="org.springfr ...
- 【Quartz】Spring Boot使用properties文件配置Quartz
(1)在resource目录下新建quartz.properties文件 #============================================================== ...
- SpringBoot中自定义properties文件配置参数并带有输入提示
1. 创建配置类 在项目中创建一个参数映射类如下 @ConfigurationProperties(prefix = "user.info") public class MyPro ...
- springboot 2.1.3.RELEASE版本解析.properties文件配置
1.有时为了管理一些特定的配置文件,会考虑单独放在一个配置文件中,如redis.properties: #Matser的ip地址 redis.host=192.168.5.234 #端口号 redis ...
- android 获取Asset中Properties文件配置的键值对
1 获取 AssetManager AssetManager assetManager = context.getApplicationContext().getAssets(); 2 获取流 Str ...
- log4cplus库的properties文件配置
使用时需要先获取一个Logger的对象,下面获取Logger对象的内容对应于配置: Logger LogConsole = Logger::getInstance(LOG4CPLUS_TEXT(&qu ...
- Spring-Boot注入自定义properties文件配置
创建wzq.properties wzq.properties注入User实体类中 @PropertySource(value = "classpath:wzq.properties&quo ...
随机推荐
- Python爬虫--抓取糗事百科段子
今天使用python爬虫实现了自动抓取糗事百科的段子,因为糗事百科不需要登录,抓取比较简单.程序每按一次回车输出一条段子,代码参考了 http://cuiqingcai.com/990.html 但该 ...
- DataBase project physical design
DataBase physical design //Table: /*student*/ create table student( id int not null primary key, /*学 ...
- 【英语】Bingo口语笔记(86) - stand系列
- win键盘映射成mac键盘
在win7系统下安装了mac虚拟机,mac的快捷键与win的键盘不一样,所以ctrl+c,ctrl+v都用不了,于是找方法映射. 搜索到 keyremap4macbook,,进到官网Karabiner ...
- UIImage+PYJColorBecomeImage
UIImage+PYJColorBecomeImage.h: // // UIImage+PYJColorBecomeImage.h // 颜色转成图片 // // Created by PengYu ...
- 把UIImage保存到照片库和沙盒中
1.保存到iOS照片库需要引入QuartzCore.framework框架,具体代码如下: .h文件 #import <QuartzCore/QuartzCore.h> UIImageVi ...
- fn project 扩展
目前支持的扩展方式 Listeners - listen to API events such as a route getting updated and react accordingly. ...
- GZip压缩与解压缩
GZIP的压缩与解压缩代码: public static class CompressionHelper { /// <summary> /// Compress the byte[] / ...
- eclipse怎么在项目里面批量替换单词
先选中你要替换的东东,然后再菜单栏中找到Search→Text→Project(先创建要搜索的project),这样就会在整个项目中查找单词.然后在Search的Console中,单击项目,右键选择R ...
- Nginx 教程示例
https://www.cnblogs.com/jingmoxukong/p/5945200.html