caching - Grails ehcache.xml custom caches configuration -


ehache.xml cache configuration has been created. setting in file works hibernate 2l cache custom caches (for example caching service methods invocation: @cacheable('somecache') ) cache plugin settings don't work

<cache name="somecache" maxelementsinmemory="100" timetoliveseconds="86400" timetoidleseconds="86400"/> 

but if setting in config.groovy -- works

grails.cache.config = {   cache {     name 'somecache'     timetoidleseconds 86400     timetoliveseconds 86400     maxelementsinmemory 100   } } 

like springcache plugin tried share cachemanager

cachemanager(ehcachemanagerfactorybean) {     shared = true } 

where no result

now have write configuration in 2 places , cache managing use grailscachemanager.cachemanager & cachemanager.instance

any ideas?

upd: configuration in config.groovy has been created

import  grails.test.test grails.cache.config = {   domain {     name test     timetoidleseconds 3600     timetoliveseconds 3600     maxelementsinmemory 50000   }   cache {     name 'mycache'     timetoidleseconds 86400     timetoliveseconds 86400     maxelementsinmemory 1000   }   defaults {     eternal false     overflowtodisk false     diskpersistent false     timetoidleseconds 600     timetoliveseconds 3600     memorystoreevictionpolicy 'lru'   } } 

domain:

package grails.test class test {   static mapping = {     cache 'nonstrict-read-write'     version false   } } 

and in controller call:

test.get(params.id) 

but cache empty: grails.test.test cur size:0

custom cache "mycache" -- work

take @ grails ehcache plugin documentation. contains sections explains how configure hibernate 2nd level cache using grails cache plugin dsl. "hibernate second-level cache" , "hibernate domain class second-level caches"


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -