I've got a strange issue when trying to cache a method call on a 'repository' object in Grails (2.1.5). This repository, a plain groovy object in src/groovy, combines data from two data sources and returns a 'Seller' object.
def aDatabaseHelper
def bDatabaseHelper
@Cacheable('seller_do_get')
public Seller get(id){
....
//do stuff with aDatabaseHelper and bDatabaseHelper
return seller
}
The SellerRepository is defined in resources.groovy
aDatabaseHelper (ADatabaseHelper ){
aDataSource = ref("dataSource_a")
}
...
sellerRepository(SellerRepository){
aDatabaseHelper = aDatabaseHelper
bDatabaseHelper = bDatabaseHelper
}
And we've got ehcahce plugin (1.0.0) installed and working fine for other objects/methods.
The above for some reason doesn't cache it - it goes inside the get method each time. I created a 'BlaRepository' which takes in the same dependencies and has a getBla(id) method and it is getting cached just fine.
Does someone has a clue what's going on here? Which silly mistake am I making?
Seems like it should work, but could be a bug. Create a small test app that demonstrates the problem and run grails bug-report
and attach it to a JIRA at http://jira.grails.org/browse/GPCACHEEHCACHE and I'll take a look.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.