我使用Grails 3.1.8。如何设置timeToLiveSeconds属性?
插件配置建议我设置:
grails.cache.config = {
cache {
…
}
defaultCache {
maxElementsInMemory 10000
eternal false
timeToIdleSeconds 120
timeToLiveSeconds 120
overflowToDisk true
maxElementsOnDisk 10000000
diskPersistent false
diskExpiryThreadIntervalSeconds 120
memoryStoreEvictionPolicy 'LRU'
}
}但这对我不起作用。如何设置默认和自定义属性?
发布于 2016-06-21 21:46:32
您链接的同一文档在提取配置示例之前和之后的部分中包含该信息。
在缓存部分中,每个缓存配置元素如下:
grails.cache.config = {
cache {
name 'mycache'
eternal false
overflowToDisk true
maxElementsInMemory 10000
maxElementsOnDisk 10000000
}
}在默认缓存和缓存默认值的后半部分中,默认值为:
grails.cache.config = {
cache {
…
}
defaults {
maxElementsInMemory 1000
eternal false
overflowToDisk false
maxElementsOnDisk 0
}
}它们都将接受timeToLiveSeconds属性的设置,因为它们只是示例,并不表示配置仅限于一组受限的属性。
发布于 2018-05-04 20:03:56
根据grails-cache-ehcache github,您需要Grails 3插件的第3版,而且根据github的文档,现在只支持XML配置。
您可以在issue#37中找到一个例子。
https://stackoverflow.com/questions/37911546
复制相似问题