Need help setting up cacheable annotation
Everything seems to be ok, but nothing gets cached. I have followed the other threads that have discussed this to no avail. there has got to be something I am missing.
Here is my configuration:
<ehcache:config configLocation="classpath:/ehcache.xml" serializableFactory="XSTREAM" />
<ehcache:annotations>
<ehcache:caching id="licenseAssetCacheModel" cacheName="licenseAssetCache"/>
<ehcache:flushing id="licenseAssetFlushModel" cacheNames="licenseAssetCache"/>
</ehcache:annotations>
I have this dependency setup in my pom.xml
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-cache</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>1.5.0</version>
</dependency>
Everything seems fine at startup:
Oct 06 2008 18:13:48 PM INFO (o.s.c.e.EhCacheManagerFactoryBean) - Initializing EHCache CacheManager
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationFactory) - Configuring ehcache from InputStream
Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.CacheManager) - No disk store path defined. Skipping disk store path conflict test.
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheManagerEventListenerFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.DiskStoreConfiguration) - Disk Store Path: /opt/software/apache-tomcat-6.0.18/temp
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No BootstrapCacheLoaderFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheLoaderFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheExceptionHandlerFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.DiskStoreConfiguration) - Disk Store Path: /opt/software/apache-tomcat-6.0.18/temp
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No BootstrapCacheLoaderFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheLoaderFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheExceptionHandlerFactory class specified. Skipping...
Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.store.MemoryStore) - Initialized net.sf.ehcache.store.LfuMemoryStore for licenseAssetCache
Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.Cache) - Initialised cache: licenseAssetCache
I have annotated the interface as such:
Cacheable(modelId = "licenseAssetCacheModel")
LicenseAsset getLicenseAsset(Long assetId);
Then, nothing. no caching. what gives.
anybody. thanks.
-zach
check out previous postings...
try to remember using for posting code...
within Spring-Modules search for RShelley post with the title "Declarative Caching" (I can't post links yet). It has a lot of useful information on setting up.
tip -> make sure the annotated part is being done in the interfaces, not the implementation classes.