日期:2014-05-17  浏览次数:20751 次

【100分】【在线等】Spring+ibatis+ehcache MethodCacheInterceptor的invoke方法没有执行
小弟最新做一个项目 需要使用到Spring+ibatis+ehcache 参照网上的资料自己写了一些配置 可惜MethodCacheInterceptor的invoke方法始终没有执行。想请各位高人指点迷津

这个是Tomcat启动log信息 其中MethodCacheInterceptor已经被初始化了

2013-10-29 10:17:24,179 INFO [org.springframework.cache.ehcache.EhCacheManagerFactoryBean]  main org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:100) - <Initializing EHCache CacheManager>
2013-10-29 10:17:26,693 INFO [net.sf.ehcache.util.UpdateChecker]  net.sf.ehcache.CacheManager@7b7d8769 net.sf.ehcache.util.UpdateChecker.doCheck(UpdateChecker.java:98) - <New update(s) found: 2.6.5 [http://www.terracotta.org/confluence/display/release/Release+Notes+Ehcache+Core+2.6]. Please check http://ehcache.org for the latest version.>
2013-10-29 10:17:30,781 INFO [com.gaotime.datadictionary.utils.MethodCacheInterceptor]  main com.gaotime.datadictionary.utils.MethodCacheInterceptor.afterPropertiesSet(MethodCacheInterceptor.java:30) - <[ name = lowFreCache status = STATUS_ALIVE eternal = false overflowToDisk = true maxEntriesLocalHeap = 100000 maxEntriesLocalDisk = 500000 memoryStoreEvictionPolicy = LFU timeToLiveSeconds = 28800 timeToIdleSeconds = 28800 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: net.sf.ehcache.statistics.LiveCacheStatisticsWrapper  hitCount = 0 memoryStoreHitCount = 0 diskStoreHitCount = 0 missCountNotFound = 0 missCountExpired = 0 maxBytesLocalHeap = 0 overflowToOffHeap = false maxBytesLocalOffHeap = 0 maxBytesLocalDisk = 0 pinned = false ] A cache is required. Use setCache(Cache) to provide one.>


这个是ehcache文件

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" 
updateCheck="true"
monitoring="autodetect">
<diskStore path="java.io.tmpdir/ehcache" /> 
<defaultCache maxElementsInMemory="10000" 
eternal="false" 
timeToIdleSeconds="600" 
timeToLiveSeconds="600" 
overflowToDisk="true" 
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="50000" 
diskPersistent="false" 
diskExpiryThreadIntervalSeconds="120" 
memoryStoreEvictionPolicy="LRU"/>

 <!-- 8小时更新缓存 -->
<cache name="lowFreCache" 
maxElementsInMemory="100000"
maxElementsOnDisk="500000" 
eternal="false" 
overflowToDisk="true"
diskPersistent="false" 
diskSpoolBufferSizeMB="30" 
timeToIdleSeconds="28800" 
timeToLiveSeconds="28800"
memoryStoreEvictionPolicy="LFU" />
</ehcache>  


这个是applicationContext-cache.xml配置ehcache

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:p="http://www.springframework.org/schema/p"
xmlns:cache="http://www.spr