Customization
Configuration
To configure Ehcache yourself, define a bean called ehcacheConfiguration
that implements EhcacheConfiguration. The configuration returned from getConfiguration
will be passed to the cache manager. See the section in the Ehcache documentation on programmatic configuration for more information.
Cache Manager
To customize how the Ehcache manager gets created, define a bean called grailsCacheManager
that extends GrailsEhcacheCacheManager. You can override the createDefaultManager
method to return an Ehcache manager in any way you like.
Ehcache 3 requires a key type and a value type when creating a cache. If a cache is specified in your code that is not specifically configured, the key and value type will be Object
. To change this behavior or to further configure the default cache, extend the grailsCacheManager
as explained above and override the createDefaultCache
method.