用ehcache做缓存,如果断电后要自动加载之前缓存,要怎么配置,一直不行啊?
Posted on用ehcache做缓存,如果断电后要自动加载之前缓存,要怎么配置,一直不行啊?
用ehcache做缓存,如果断电后要自动加载之前缓存,要怎么配置,一直不行啊?
zwt 发表于 5-3 13:09 5个月前, 4回/600阅, 最后回答: 1个月前 讨论区 » 技术问答
【杭州】开源中国-源创会第十三期开始报名 我要报名» 在使用ehcache 如果碰到意外情况,断电或服务器挂掉,我希望重启后 ehcache 能自动加载之前的缓存,但一直试都不行,不知道要怎么配置;
目前在重启服务器的时候会提示:
警告: The index for data file stake.data is out of date, probably due to an unclean shutdown. Deleting index file stake.index
目前配置: view sourceprint?
01
<
diskStore
path
=
"java.io.tmpdir"
/>
02
03
<
defaultCache
04
maxElementsInMemory
=
"10000" 05
eternal
=
"false"
06
timeToIdleSeconds
=
"43200" 07
timeToLiveSeconds
=
"43200"
08
overflowToDisk
=
"true" 09
diskPersistent
=
"true"
10
diskExpiryThreadIntervalSeconds
=
"120" 11
memoryStoreEvictionPolicy
=
"LFU"
12
/>
标签: EhCache Java 我想问同样的问题 共1个人想要问同样的问题 补充话题说明»
收藏 **
6 **
举报 **
按评价排序 | 显示最新答案 | 回页面顶部 共有4个答案 我要回答»
zwt 回答于 2012-05-03 13:32
举报 已经解决,在ehcache初始化之前
System.setProperty("net.sf.ehcache.enableShutdownHook","true");
请看 http://stackoverflow.com/questions/2373431/ehcache-disk-store-unclean-shutdown
有帮助(0) | 没帮助(0) | 评论(0) | 引用此答案
samsamsam 回答于 2012-05-14 16:29
举报 我想请教,我按照
System.setProperty("net.sf.ehcache.enableShutdownHook","true");
这个方法试过还是The index for data file is out of date。。。。。 --- 共有 1 条评论 ---
- 你要在加载ehcache之前设置环境变量,设置成功后看会输出log (4个月前 by zwt) 回复
有帮助(0) | 没帮助(0) | 评论(1) | 引用此答案
fbfan520 回答于 2012-09-05 14:00
举报 System.setProperty("net.sf.ehcache.enableShutdownHook","true");请问这句加在哪里 --- 共有 1 条评论 ---
- 在ehcache初始化之前 (1个月前 by zwt) 回复
有帮助(0) | 没帮助(0) | 评论(1) | 引用此答案
fbfan520 回答于 2012-09-07 13:35
举报 在ehcache初始化之前是什么意思? public static CacheManager manager = CacheManager.create("D:\XML\ehcache.xml"); public static Cache diskOnlyEternalCache = null; public static Cache diskEternalCache = null; public static Cache disk7DayCache = null; public static Cache diskSyn7DayCache = null; public static Cache disk1DayCache = null;
private CacheManageService() {
}
public synchronized static Cache getDiskOnlyEternalCache() {
if (diskOnlyEternalCache == null) {
diskOnlyEternalCache = manager.getCache("diskOnlyEternalCache");
}
return diskOnlyEternalCache;
}
像这个程序我加在哪里? 有帮助(0) | 没帮助(0) | 评论(0) | 引用此答案
) ")")") 回答案顶部 | 回页面顶部 有什么技术问题吗? 我要提问
全部(3)...zwt的其他问题
- oschina 评论盖楼是怎么实现的?(1回/97阅,1个月前)
extremetable 页数过多的情况显示怎么处理(0回/50阅,6个月前) 类似的话题
ehcache并发的问题。(2回/151阅,1个月前)
- EhCache cluster 不能复制(2回/121阅,3个月前)
- EHCache RMI同步(2回/98阅,1个月前)
- ehcache缓存失效问题(4回/539阅,1年前)
- 请教ehcache的notifyElementExpired的事件用法(7回/138阅,5个月前)
- EhCache 缓存嵌入对象问题(7回/317阅,7个月前)
- ehcache如何增量加入缓存(1回/410阅,1年前)
- ehcache分布式同步问题(3回/360阅,7个月前)
- ehcache如何设置输出打印日志(4回/574阅,1年前)
- Ehcache 2.4.1 Search 问题!!!!(3回/251阅,1年前)
- Ehcache配置文件中各项参数(1回/722阅,2年前)
- 在ehcache中如何配置多个diskStore(2回/81阅,3个月前)
- ehcache2.5缓存问题,求解??????(5回/294阅,6个月前)
- 跑EhCache 集群演示程序读cache的值为null(0回/166阅,1年前)
- 用了红薯大哥的EhCache缓存代码,调试后出错,各位大侠能否给一个些建议?(7回/425阅,6个月前)
- Ehcache gzipFilter(3回/250阅,7个月前)
© 开源中国社区(OsChina.NET) | 关于我们 | 广告联系 | @新浪微博 | 开源中国手机版 | 粤ICP备12009483号-3