Tobias Kraft
Tobias Kraft

Reputation: 348

Grails 3 with Ehcache Plugin

We are trying to use the EHCache Plugin with Grails 3.

In the build.gradle file we have inserted the following configuration:

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

When using the @Cachable annotation for services the stuff is cached by the Default Cache manage of the Core Plugin and it is not cached by the EHCache. This results in an endless caching until the application is restarted.

It seems that the grailsCacheManager is not set to the GrailsEhcacheCacheManager class. Has someone successfully configured the EHCache plugin with grails 3 and can provide the configuration?

Upvotes: 2

Views: 936

Answers (1)

Tobias Kraft
Tobias Kraft

Reputation: 348

I found the problem: For grails 3 the SNAPSHOT version has to be used for the grails cache plugin.

More information are available here: https://github.com/grails-plugins/grails-cache-ehcache/issues/26

My configuration in build.gradle for the EH Cache plugin looks now like that:

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"

Upvotes: 2

Related Questions