Java的中间件-OSCache

使用OSCache进行简单的缓存

在目前流行的三种开源的缓存工具中,OSCache的配置和使用应给是最简单的了,它主要是针对页面级的配置,EHCache主要针对对象级的缓存,MemCached应该是比较完整的了。接下来我们简单的讲一下在你的系统中怎样快速的应用上OSCache。只需简单的两步。

第一步:加载oscache.properties文件,默认放到src目录下。下面是oscache.xml的默认配置。你只需简单的去掉一些注释就可以用了。

# CACHE IN MEMORY

#

# If you want to disable memory caching, just uncomment this line.

#

# cache.memory=false

# CACHE KEY

#

# This is the key that will be used to store the cache in the application

# and session scope.

#

# If you want to set the cache key to anything other than the default

# uncomment this line and change the cache.key

#

# cache.key=__oscache_cache

# USE HOST DOMAIN NAME IN KEY

#

# Servers for multiple host domains may wish to add host name info to

# the generation of the key. If this is true, then uncomment the

# following line.

#

# cache.use.host.domain.in.key=true

# CACHE LISTENERS

#

# These hook OSCache events and perform various actions such as logging

# cache hits and misses, or broadcasting to other cache instances across a cluster.

# See the documentation for further information.

#

# cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JMSBroadcastingListener, /

# com.opensymphony.oscache.extra.CacheEntryEventListenerImpl, /

# com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl, /

# com.opensymphony.oscache.extra.ScopeEventListenerImpl, /

# com.opensymphony.oscache.extra.StatisticListenerImpl

# CACHE PERSISTENCE CLASS

#

# Specify the class to use for persistence. If you use the supplied DiskPersistenceListener,

# don't forget to supply the

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值