Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Firstly, if you want to cache the query, then perhaps using the Hibernate query cache is a good start (Set <code>cache:true</code> in the <code>mappings</code> and pass <code>cache: true</code> to the <code>executeQuery</code>)</p> <p>Using the <a href="http://www.grails.org/plugin/springcache" rel="nofollow">SpringCache plug-in</a> will allow you to cache the entire response from the controller. All you would need to do is decorate the controller like that: <code>@Cacheable("searchMethodCache")</code> or only decorate individual methods that you want results of cached. The cache will save response by query string so it should work well with paging. The <code>@CacheFlush</code> annotation allows to set when the cache should be cleared.</p> <p>The EH Cache itself is configured in <code>grails-app/conf/spring/resources.groovy</code></p> <p><em>-- UPDATE --</em></p> <p>Following you comment I begin to suspect your might be thinking of a slightly different solution. So there is a query that returns a list of results and that list is then paged and displayed. With standard Grails approach Hibernate will generate one query for each page (returning a subset from the full list thus running the potentially expensive query once for each page). Presumably you want the query to be run once - to return the full result set that gets cached and then serve individual pages from the it. If that's the case, far as I know, you will have to page the results manually either from the Hibernate cache or caching the result set somewhere else (Session context?)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload