• 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
    指集群中的额外配置项.

  • 相关阅读:
    iOS8之后,UITableViewRowAction实现滑动多个按钮
    关于UINavigationController的一些技巧
    NSRegularExpression 使用
    UIWindow
    SVN:The working copy is locked due to a previous error (二)
    iOS监听电话来电、挂断、拨号等
    UIDeviceOrientation 和 UIInterfaceOrientation
    java_day03
    java_day 02
    java_day_02
  • 原文地址:https://www.cnblogs.com/linjiqin/p/3221335.html
Copyright © 2020-2023  润新知