2013-10-09 2 views
3

저는 Spring 프로젝트로 ehcache를 구현하고 있지만 성공하지는 못했습니다.CacheDecoratorFactory가 설정된 Spring에서 Ehcache가 설정되지 않았습니다.

@Cacheable(cacheName="listTop") 
public void listTop(News news, String regionCode, Integer count, Integer categoryId, String listType){ 
//code here// 
} 

I : 여기

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">  

    <diskStore path="java.io.tmpdir" /> 
    <defaultCache eternal="true" maxElementsInMemory="100" overflowToDisk="false" /> 
    <cache name="listTop" maxElementsInMemory="10" eternal="true" overflowToDisk="false" /> 

</ehcache> 

내 구현 클래스입니다 : 여기
<ehcache:annotation-driven /> 
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> 
    <property name="configLocation" value="/META-INF/spring/ehcache.xml" /> 
</bean> 

가 ehcache.xml 내 설정은 다음과 같습니다

은 applicationContext.xml에서 내 설정입니다 캐시가 구성되어 있지 않은 것으로 보이는 다음 메시지가 나타납니다.

1827 DEBUG net.sf.ehcache.config.BeanHandler - Ignoring ehcache attribute xmlns:xsi 
1827 DEBUG net.sf.ehcache.config.BeanHandler - Ignoring ehcache attribute xsi:noNamespaceSchemaLocation 
1828 DEBUG net.sf.ehcache.config.DiskStoreConfiguration - Disk Store Path: C:\Users\TOMMY~1.LOC\AppData\Local\Temp\ 
1847 DEBUG net.sf.ehcache.util.PropertyUtil - propertiesString is null. 
1860 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheManagerEventListenerFactory class specified. Skipping... 
1918 DEBUG net.sf.ehcache.Cache - No BootstrapCacheLoaderFactory class specified. Skipping... 
1918 DEBUG net.sf.ehcache.Cache - CacheWriter factory not configured. Skipping... 
1918 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheExceptionHandlerFactory class specified. Skipping... 
1932 DEBUG net.sf.ehcache.Cache - No BootstrapCacheLoaderFactory class specified. Skipping... 
1932 DEBUG net.sf.ehcache.Cache - CacheWriter factory not configured. Skipping... 
1932 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheExceptionHandlerFactory class specified. Skipping... 
1954 DEBUG net.sf.ehcache.store.MemoryStore - Initialized net.sf.ehcache.store.MemoryStore for listTop 
1991 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_OFFHEAP_SIZE 
1993 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_OFFHEAP_SIZE_BYTES 
1994 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_DISK_SIZE 
1994 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LOCAL_DISK_SIZE_BYTES 
1994 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: WRITER_QUEUE_LENGTH 
1994 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: REMOTE_SIZE 
1995 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Pass-Through Statistic: LAST_REJOIN_TIMESTAMP 
2012 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_GET 
2013 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_PUT 
2014 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: OFFHEAP_REMOVE 
2014 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: DISK_GET 
2014 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: DISK_PUT 
2015 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: DISK_REMOVE 
2015 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_COMMIT 
2015 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_ROLLBACK 
2016 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: XA_RECOVERY 
2017 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: CLUSTER_EVENT 
2017 DEBUG net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl - Mocking Operation Statistic: NONSTOP 
2024 DEBUG net.sf.ehcache.Cache - Initialised cache: listTop 
2024 DEBUG net.sf.ehcache.config.ConfigurationHelper - CacheDecoratorFactory not configured. Skipping for 'listTop'. 
2024 DEBUG net.sf.ehcache.config.ConfigurationHelper - CacheDecoratorFactory not configured for defaultCache. Skipping for 'listTop'. 

알고 계시나요? 많은 감사합니다.

답변

3

는이 같은 정의 캐시에 장식을 적용 EHCache는 말할 필요 (당신은 당신이 원하는 것을 할 MyCacheDecoratorFactory을 구현해야) : 나는 당신이 등록 정보를 전달할 수 있다는 사실을 놓친

<cache name="listTop" maxElementsInMemory="10" eternal="true" overflowToDisk="false" ><cacheDecoratorFactory class="com.test.MyCacheDecoratorFactory", properties="blah=true,someValue=2000" /></cache> 
+0

- 감사합니다 – Ryan

관련 문제