Ehcache 中diskStore path 的作用以及说明

ehcache.xml中 有这么一句 <diskStore path="/home/cache"/>


diskStore paht 需要结合overflowToDisk参数来用

由于配置文件中只能指定maxElementsInMemory,这就会有可能存入的对象太多而超出VM的 heap大小,当然你可以通过jvm参数增大heap大小,但这总还是有可能溢出。这里可以把maxElementsInMemory值设置到一个比较安 全的大小,自己预先测试一下最好。如果内存仍然存不下你需要存的对象个数,那么可以开启overflowToDisk来增加可以存储的Element个 数。这里要注意一下,EHCache不会自动帮助你去把内存对象写入到磁盘,当超过maxElementsInMemory程序会自动把更多的部分开始往 硬盘写,但是内存的对象其实并没有清出去,这时需要手动使用Cache.flush()方法来把内存对象
 
重建上一次运行的缓存:这个需求肯定比较普遍,我们当然不希望一旦程序退出,整个缓存就要重建了。开启diskPersistent功 能,只要使用的是CacheManager单例模式,下一次启动的时候就会调用上一次运行的缓存。比较麻烦的是写入磁盘的时间还是要自己调用 Cache.flush()方法。如果仅仅考虑到程序重启的话,我建议这里把diskStore写入到一个ramfs,这样性能就更高了,但重启电脑的话 就不得不重建缓存了。


阅读更多

The diskStore path for this CacheManager will be set……

07-27

rn刚接触SSH 又有问题了,rnrnrntomcat 启动出现下面的,这个怎么解决呢 ?听说和ehcache.xml 有关还是?(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#createCacheProvider : Cache provider: org.hibernate.cache.EhCacheProviderrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Optimize cache for minimal puts: disabledrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Structured second-level cache entries: disabledrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#createQueryCacheFactory : Query cache factory: org.hibernate.cache.StandardQueryCacheFactoryrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Statistics: disabledrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Deleted entity synthetic identifier rollback: disabledrn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Default entity-mode: pojorn(15922 ms) [main] INFO : org.hibernate.cfg.SettingsFactory#buildSettings : Named query checking : enabledrn(15953 ms) [main] INFO : org.hibernate.impl.SessionFactoryImpl# : building session factoryrn(15953 ms) [main] WARN : net.sf.ehcache.config.ConfigurationFactory#parseConfiguration : No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/Workspaces/maintain1/src/main/webapp/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xmlrn(15953 ms) [main] WARN : net.sf.ehcache.CacheManager#detectAndFixDiskStorePathConflict : Creating a new instance of CacheManager using the diskStorePath "D:\tools\tomcat6\temp" which is already used by an existing CacheManager.rnThe source of the configuration was classpath.rnThe diskStore path for this CacheManager will be set to D:\tools\tomcat6\temp\ehcache_auto_created_1311761286687.rnTo 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.rn(16047 ms) [main] INFO : org.hibernate.impl.SessionFactoryObjectFactory#addInstance : Not binding factory to JNDI, no JNDI name configuredrn(16047 ms) [main] INFO : org.hibernate.cache.UpdateTimestampsCache# : starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCachern(16047 ms) [main] WARN : org.hibernate.cache.EhCacheProvider#buildCache : Could not find configuration [org.hibernate.cache.UpdateTimestampsCache]; using defaults.rn(16047 ms) [main] INFO : org.hibernate.cache.StandardQueryCache# : starting query cache at region: org.hibernate.cache.StandardQueryCachern(16047 ms) [main] WARN : org.hibernate.cache.EhCacheProvider#buildCache : Could not find configuration [org.hibernate.cache.StandardQueryCache]; using defaults.rn(16078 ms) [main] INFO : org.quartz.core.QuartzScheduler# : Quartz Scheduler v.1.6.0 created.rn(16078 ms) [main] INFO : org.quartz.simpl.RAMJobStore#initialize : RAMJobStore initialized.rn(16078 ms) [main] INFO : org.quartz.impl.StdSchedulerFactory#instantiate : Quartz scheduler 'org.springframework.scheduling.quartz.SchedulerFactoryBean#1' initialized from an externally provided properties instance.rn(16078 ms) [main] INFO : org.quartz.impl.StdSchedulerFactory#instantiate : Quartz scheduler version: 1.6.0rn(16078 ms) [main] INFO : org.quartz.core.QuartzScheduler#setJobFactory : JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@8f6d20rn(16109 ms) [main] INFO : org.springframework.scheduling.quartz.SchedulerFactoryBean#startScheduler : Starting Quartz Scheduler nowrn(16109 ms) [main] INFO : org.quartz.core.QuartzScheduler#start : Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#1_$_NON_CLUSTERED started.rn(16109 ms) [main] INFO : org.springframework.web.context.ContextLoader#initWebApplicationContext : Root WebApplicationContext: initialization completed in 1047 msrn(16687 ms) [main] INFO : com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#info : Parsing configuration file [struts-default.xml]rn(17172 ms) [main] INFO : com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#info : Parsing configuration file [struts-plugin.xml]rn(17281 ms) [main] INFO : com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#info : Parsing configuration file [struts.xml]rn(17297 ms) [main] INFO : com.opensymphony.xwork2.config.impl.DefaultConfiguration#info : Overriding property struts.i18n.reload - old value: false new value: truern(17297 ms) [main] INFO : com.opensymphony.xwork2.config.impl.DefaultConfiguration#info : Overriding property struts.configuration.xml.reload - old value: false new value: truern(17687 ms) [main] INFO : org.apache.struts2.spring.StrutsSpringObjectFactory#info : Initializing Struts-Spring integration...rn(17687 ms) [main] INFO : com.opensymphony.xwork2.spring.SpringObjectFactory#info : Setting autowire strategy to namern(17687 ms) [main] INFO : org.apache.struts2.spring.StrutsSpringObjectFactory#info : ... initialized Struts-Spring integration successfullyrn2011-7-27 18:08:10 org.apache.catalina.startup.HostConfig deployDescriptorrn信息: Deploying configuration descriptor manager.xmlrn2011-7-27 18:08:10 org.apache.catalina.startup.HostConfig deployDirectoryrn信息: Deploying web application directory docsrn2011-7-27 18:08:10 org.apache.catalina.startup.HostConfig deployDirectory

没有更多推荐了,返回首页