2017-02-27 99 views
1

我們正在嘗試使用插件的EHCache使用Grails 3.的Grails 3的Ehcache插件

在我們插入以下配置的build.gradle文件:

compile "org.grails.plugins:cache" 
compile("org.grails.plugins:cache-ehcache:1.0.5") { 
    exclude module: "cache" 
} 

當使用@Cachable註解對於服務,這些內容由Core Plugin的Default Cache管理緩存,並且不會被EHCache緩存。這會導致無限的緩存,直到應用程序重新啓動。

似乎grailsCacheManager未設置爲GrailsEhcacheCacheManager類。 有人用grails 3成功配置了EHCache插件並可以提供配置嗎?

回答

1

我發現問題:對於grails 3,SNAPSHOT版本必須用於grails緩存插件。

更多信息,可在這裏: https://github.com/grails-plugins/grails-cache-ehcache/issues/26

我在的build.gradle爲EH緩存插件配置現在看起來像這樣:

compile ("org.grails.plugins:cache-ehcache:3.0.0.BUILD-SNAPSHOT") { 
    exclude group:'net.sf.ehcache' 
} 
// we have to downgrade the ehcache version. Otherwise it will not work together with hibernate ehcache 
compile "net.sf.ehcache:ehcache:2.4.3"