gpt4 book ai didi

Spring-modules 缓存不起作用...静默

转载 作者:行者123 更新时间:2023-12-04 07:09:41 28 4
gpt4 key购买 nike

我正在尝试使用 Spring Modules 项目中的声明性缓存。

它不起作用,即。似乎没有任何东西被缓存。

这是我的配置:

<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
</bean>

<bean id="cacheProviderFacade"
class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
<property name="cacheManager" ref="cacheManager" />
</bean>

<bean id="cacheableService"
class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
<property name="cacheProviderFacade" ref="cacheProviderFacade" />
<property name="cachingModels">
<props>
<prop key="get*">cacheName=default</prop>
</props>
</property>
<property name="flushingModels">
<props>
<prop key="update*">cacheNames=default</prop>
</props>
</property>
<property name="target" ref="myServiceBean" />
</bean>

然后,这是 Spring 加载应用程序上下文时的日志记录......
24 Feb 2009 14:26:20,785 INFO    org.springframework.cache.ehcache.EhCacheManagerFactoryBean - Initializing EHCache CacheManager
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.CacheManager - Configuring ehcache from classpath.
24 Feb 2009 14:26:20,801 WARN net.sf.ehcache.config.ConfigurationFactory - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: zip:C:/bea/weblogic81/server/bin/myserver/.wlnotdelete/extract/myserver_threeoneoneonline_threeoneoneonline/jarfiles/WEB-INF/lib/ehcache-1.3.0.jar!/ehcache-failsafe.xml
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from URL: zip:C:/bea/weblogic81/server/bin/myserver/.wlnotdelete/extract/myserver_threeoneoneonline_threeoneoneonline/jarfiles/WEB-INF/lib/ehcache-1.3.0.jar!/ehcache-failsafe.xml
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from InputStream
24 Feb 2009 14:26:20,816 DEBUG net.sf.ehcache.config.DiskStoreConfiguration - Disk Store Path: C:\DOCUME~1\bpapa\LOCALS~1\Temp\
24 Feb 2009 14:26:20,832 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheManagerEventListenerFactory class specified. Skipping...
24 Feb 2009 14:26:20,832 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.
24 Feb 2009 14:26:20,847 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.
24 Feb 2009 14:26:20,863 DEBUG net.sf.ehcache.config.ConfigurationHelper - No BootstrapCacheLoaderFactory class specified. Skipping...

在此之后,我点击了一个页面,该页面从“myServiceBean”bean 中调用了一个以“get”为前缀的方法。但是,没有记录任何缓存正在进行。我已经将日志记录一路调高到调试 springmodules、spring 的缓存包和 DEBUG ......因为 Spring Modules 的例子在网络上很少而且相距甚远,我想知道是否有人以前看过这个......

最佳答案

您应该为您的配置创建一个 ehcache.xml 文件,因为我不相信故障安全缓存适用于声明性缓存。我们使用 ehcache Spring 模块 XML 模式和注释来设置缓存。如果使用显式 ehcache.xml 不能解决您的问题,那么我可以挖掘一些代码(接近)您的方式。

关于Spring-modules 缓存不起作用...静默,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/583420/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com