hibernate - Grails query cache is ignored -


i have application read-mostly, queries use hibernate 2nd-level query cache. have 1 query must executed every time page loads, invoke layout gsp this:

${book.countbyapproved(true, [cache: true])} 

i have enabled 2nd-level cache book class, adding

static mapping = {     cache true } 

to book.groovy. have following configured in datasource.groovy

hibernate {   cache.use_second_level_cache = true   cache.use_query_cache = true   cache.region.factory_class = 'net.sf.ehcache.hibernate.ehcacheregionfactory' } 

in same file i've enabled query logging adding logsql=true in datasource block.

every time load page, book.countbyapproved(true) query logged, assume means results not being retrieved query cache? i'm running locally, there's no possibility cache being missed because cached query results have expired.

i don't know if relevant, i'm using hibernate filters plugin , have default filter configured book class. perhaps there's issue using hibernate filters , query cache?

if i'm not mistaken. there's question equals yours, , advice not use querys in gsps. try in filter , see if cache works.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -