, cache-ehcache TTL , EhCache. , , TTL, Cache DSL .
EhCache, Config.groovy CacheConfig.groovy:
grails.cache.config = {
cache {
name 'mycache'
}
//this is not a cache, it a set of default configs to apply to other caches
defaults {
eternal false
overflowToDisk true
maxElementsInMemory 10000
maxElementsOnDisk 10000000
timeToLiveSeconds 300
timeToIdleSeconds 0
}
}
:
grailsCacheManager.cacheNames.each {
def config = grailsCacheManager.getCache(it).nativeCache.cacheConfiguration
println "timeToLiveSeconds: ${config.timeToLiveSeconds}"
println "timeToIdleSeconds: ${config.timeToIdleSeconds}"
}
EhCache javadoc CacheConfiguration . grails.plugin.cache net.sf.ehcache.
, Grails , EhCache. EhCache ( ehcache.xml ), , Grails.
. Cache-EhCache , TTL , ; Grails-Cache-Ehcache 1.1.