In-Memory-Cache & Pagination

T

typo

Guest
Hello!

Let's say I have a domain class called "Category" that can contain x
"Product" and I want to store these via second-level-caching of Hibernate
and Memcached as provider.
(Since I have read that query caching can be negative, I turned that one
off. As far as I understood, if any product or category object was edited or
added, the whole query cache is flushed.)

So far, so god: I'm able to access my object via Product.get(1) and it reads
out of the memory.

But: How can I do pagination? As soon as I use offset and max, I need to use
Queries like: Product.findAll(..) and these would hit the DB directly
instead of use the cache.

What's the way of implementing an in-memory-cached solution and pagination?

Thanks a lot!
Best.
Sullivan
 
Top