Question

Does anybody know if it is possible to implement pagination over entry set while using transactional scheme in Coherence? The LimitFilter way does not work as it is not supported in Transactional scheme.

Was it helpful?

Solution

I have to admit that this is a very complicated use case, and you are correct that the LimitFilter doesn't help here.

For queries of a "manageable size", my advice is to cache the contents of the keySet() itself where the paged results are needed, and use those contents for pagination. For example, store off keySet(query).toArray(), and then to access any chunk of the entries from that cache, e.g. if a page size is 20, then this should grab the entries for one page (where "page" is a 0-based int):

Map mapForOnePage = cache.getAll(new ImmutableArrayList(arrayOfKeys, page*20, 20));

(ImmutableArrayList is in the com.tangosol.util package.)

Hope this helps :)

For the sake of full disclosure, I work at Oracle. The opinions and views expressed in this post are my own, and do not necessarily reflect the opinions or views of my employer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top