-
Ehcache缓存警告问题?10
请教各位,我在spring+hibernate里配置Ehcache缓存,出现以下警告,请问是什么原因呢?
警告: Creating a new instance of CacheManager using the diskStorePath "D:\Apache Tomcat 6.0.18\temp" which is already used by an existing CacheManager.
The source of the configuration was classpath.
The diskStore path for this CacheManager will be set to D:\Apache Tomcat 6.0.18\temp\ehcache_auto_created_1262783591937.
To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.
applicationContext.xml里
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
ehcache.xml里
<ehcache>
<diskStore path="java.io.tmpdir" />
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="60" timeToLiveSeconds="60" overflowToDisk="true"
diskSpoolBufferSizeMB="30" maxElementsOnDisk="1000000"
diskPersistent="false" diskExpiryThreadIntervalSeconds="60"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
2010年1月06日 21:41
1个答案 按时间排序 按投票排序
-
采纳的答案
说下自己的经历吧 : 我之前是只写了自己的 缓存.没有写 默认的
<?xml version="1.0" encoding="UTF-8"?> <ehcache> <diskStore path="java.io.tmpdir" /> <!-- name: Cache的唯一标识. maxElementsInMemory: 内存中最大缓存对象数. maxElementsOnDisk: 磁盘中最大缓存对象数, 若是0表示无穷大. eternal: Element 是否永久有效, 一但设置了, timeout 将不起作用. overflowToDisk: 当内存中 Element 数量达到 maxElementsInMemory 时, Ehcache 是否将 Element 写到磁盘中. timeToIdleSeconds: 设置 Element 在失效前的允许闲置时间. 仅当 element 不是永久有效时使用, 可选属性, 默认为 0 : 表示可闲置时间无穷大. timeToLiveSeconds: 设置 Element 在失效前允许存活时间. 最大时间介于创建时间和失效时间之间. 仅当 Element 不是永久有效时使用, 默认为 0 : 表示存活时间无穷大. diskPersistent: 是否缓存虚拟机重启期数据. (一直没明白这个虚拟机是指什么). diskExpiryThreadIntervalSeconds: 磁盘失效线程运行时间间隔, 默认是 120 秒. diskSpoolBufferSizeMB: 这个参数设置 DiskStore(磁盘缓存) 的缓存区大小. 默认 30MB. memoryStoreEvictionPolicy: 当达到 maxElementsInMemory 限制时, Ehcache 将会根据指定的策略去清理内存. 默认策略是 LRU(最近最少使用). 可以设置为 FIFO(先进先出) 或 LFU(较少使用). --> <cache name="sampleCache1" maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true" /> </ehcache>
启动的时候报没有默认缓存配置的 WARN , 后来加上就好了<defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" />
2010年1月07日 10:41
相关推荐
mybatis添加ehcache缓存支持,基于maven项目管理
cache、ehcache等缓存使用,实现存对象读对象等等
EhCache 是一个纯 Java 的进程内缓存框架,具有快速、精干等特点,是 Hibernate 中...4)缓存数据有两级:内存和磁盘,因此无需担心容量问题 5)缓存数据会在虚拟机重启的过程中写入磁盘 6)可以通过 RMI、可插入 API
Java 缓存技术 <?xml version="1.0" encoding="UTF-8"?> <ehcache> maxElementsInMemory="10000" !-- 缓存最大数目 --> eternal="false" !-- 缓存是否持久 --> overflowToDisk="true" !-- 是否...
EHCache缓存的说明文档是到处找来的内容,都有参考链接指向原地址。有三个测试项目也在里面:一个整合了Struts2或Hibernate,一个整合了MyBatis3,这两个是我做的;另一个ehcachetest是下载了別人的。
基于SpringBoot+Layui搭建的学生管理系统,融合shiro安全框架和Ehcache缓存框架 基于SpringBoot+Layui搭建的学生管理系统,融合shiro安全框架和Ehcache缓存框架 基于SpringBoot+Layui搭建的学生管理系统,融合shiro...
EHcache缓存框架,ehcache介绍与说明,Ehcache详细,EHcache集群环境配置
Ehcache缓存技术 Ehcache缓存技术 Ehcache缓存技术 Ehcache缓存技术 Ehcache缓存技术
ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache...
ehcache缓存页面 ehcache缓存页面
对数据缓存技术的一个总结,文档比较全面的阐述了缓存类型,功能特性和相关技术。
ehcache缓存的jar包和配置文件。
Ehcache缓存配置
两级缓存在redis的方案上做一步优化,在缓存到远程redis的同时,缓存一份到本地进程ehcache(此处的ehcache不用做集群,避免组播带来的开销),取缓存的时候会先取本地,没有会向redis请求,这样会减少应用服务器<–...
hibernate最核心的 就是缓存技术
ehcache缓存
ehcache缓存依赖的jar
Ehcache缓存配置说明帮助你如何使用Ehcache
本工程用于研究如何借助Ehcache缓存框架实现对页面的缓存 本工程编码方式:UTF-8 本工程开发工具:MyEclipse 说明: 1、ehcache.xml和ehcache.xsd两个文件可以在下在下载下来的名为“ehcache-core-x.x.x-...
ehcache缓存配置详解 个人通过查资料和实践后总结