我使用 ehcache 作为二级缓存来运行 Grails 应用程序,并且它可以工作。我安装了ehcache
插件+cache
插件,然后就没有了。我尝试了互联网上几乎所有的解决方案,但没有找到我一直得到的解决方案Another unnamed CacheManager already exists in the same VM
.
可能的解决方案之一是设置p:shared=true
in the EhCacheManagerFactoryBean
,如果我使用旧插件“grails 的 springcache 插件”,则此方法有效,但使用新插件时,他们使用此管理器的修改版本,并且共享属性不可用。
我尝试定义一个新的ehcache.xml
文件,但我仍然无法为此缓存管理器输入新名称。
我尝试改变cache.provider
我里面的类DataSource.groovy
互相利用EhCacheProvider
比如一个Singleton
.
不用说,我测试过在不同的地方使用 DSL 放置不同的名称,但仍然没有成功。
最后,我使用旧的 spring 缓存插件,该插件已被弃用。有人可以帮忙吗?
我正在使用 Grails 2.0.3 和ehcache-core:2.5.3
.
In the hibernate
的部分DataSource.groovy
,确保你的cache.provider.class
已是最新:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory' // For Hibernate before 4.0
cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory4' // For Hibernate before 4.0 and higher
}
我遇到了同样的问题,因为我的cache.region.factory_class
已经过时了:net.sf.ehcache.hibernate.EhCacheProvider
.
See http://grails-plugins.github.io/grails-cache-ehcache/guide/usage.html http://grails-plugins.github.io/grails-cache-ehcache/guide/usage.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)