1 Reply Latest reply: May 21, 2013 9:08 AM by Jonathan.Knight RSS

    Continuous Query Cache (CQC) usage vs map listener

      I have a front-end (UI) which needs to display at most 100 entries from my distributed cache. The entries in the cache are pretty dynamic in nature, they can be deleted, added or updated either from the UI (extend clients) or from a process within the cluster.

      The requirement i have is to show 100 entries on my UI at any moment. The cache could have less than 100 entries too.
      My question is, can i use a CQC with a LimitFilter of 100 entries and have coherence push the 100 entries i need to my UI client? So, if the cache has 100 entries to start with, and 5 entries is removed, i will have only 95 to show. Now, if 2 more entries are added, then i should show 97. Same holds for updates to the entries. You get the picture right? So, will the CQC take care of filling the 100 entries dynamically without me worrying about what entries were removed or added on my cache?

      If CQC is the right choice, i am assuming i also need a map listener to listen on add/delete/update events to the cache so that i know when those events happen, and this is only informational, since my CQC still holds the 100 entries. Is my assumption right?

      One last question, how is a CQC different than a map listener with a filter(Limit Filter)?

      Please advise.
        • 1. Re: Continuous Query Cache (CQC) usage vs map listener

          First, you cannot use a LimitFilter with a CQC, if you try you will get an UnsupportedOperationException.

          A CQC tends to be a good solution for UI use cases. We have a UI that displays real-time data from our cluster and we use CQCs a lot for this. Another point is that a CQC cannot use Filters that use PofExtractors either as the CQC may run the Filter on the deserialized values on client side as well as the cluster and a PofExtractor will not work on the deserialized contents of the CQC.