NCache 4.6 - Online Documentation


Distributed caching is the main need in this technological era where large scale multi-tier applications are built to cater millions of clients for high performance and scalability. But applications that require data changes rapidly demand synchronization of caches and client with the same pace. With synchronization of cache, it is also needed that all clients can share information related to some specific data set whenever any change occur in it.
Continuous query is provided by NCache for runtime monitoring and tracking of data related to observable data set. For example, if there is a web application regarding stock exchange where stock values will change frequently for any company.
The application’s clients will only be interested in the companies where they have shares. The query criteria for clients having shares in some companies are maintained and data related to only those companies should be updated on each clients view. In runtime applications, data addition is also runtime and there is no way of knowing when a specific query related data will be inserted in cache. For this, the client  can register his/her query prior to data additions and when any cached item fulfilling the query criteria is added in cache, clients will be notified automatically.
NCache allows the user to specify any query criteria for indexed classes.
Changes in result set of a query can be triggered by:
  • Add: Adding an item in cache or updating any existing item can add the item in any query.
  • Update: Updating any existing cache item but it remains in query result set.
  • Remove: Removing item from cache or updating any existing cached item cause that item removal from query result set.
You can also specify filters for notifications that your cache client will receive. Filters are basically for the amount of modified cached item related data that you will receive in your query notifications.
NCache provides 3 types of filters mentioned below:
  • None (minimum data that is only key)
  • Metadata (key with metadata related to cached item)
  • Data with metadata (key with complete cached and related data)
If any cached item related to result set of any registered query is removed due to  expiration, eviction or dependencies then its notification will be sent to interested cache clients.
GROUP BY and Tags are not supported in this feature.
You may have an application that has .NET and Java clients. By enabling the data sharing feature on your cluster cache, you can index the same objects for both clients even with the same query. Notifications will be sent to each client irrespective of the platform for cached items added, updated or removed by both clients in any registered query result set.
For this feature, extra processing is included for monitoring and notifying clients which consume resources. So for efficiently using this feature, you should take care of its usage too. If all your applications do not require tracking of any query result set then you should not only unregister notifications but also unregister the query from your cache.
See Also