Class ContinuousQuery
Class to hold Object query and values, intended for notifications.
Inheritance
Namespace:
Assembly: Alachisoft.NCache.Web.dll
Syntax
public class ContinuousQuery
Constructors
ContinuousQuery(String, Hashtable)
Initializes a new instance of the ContinuousQuery class.
Declaration
public ContinuousQuery(string query, Hashtable values)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | Query text |
System.Collections.Hashtable | values | Query values |
Fields
CQREFSTARTAdd
Declaration
public const short CQREFSTARTAdd = 2000
Field Value
Type | Description |
---|---|
System.Int16 |
CQREFSTARTRemove
Declaration
public const short CQREFSTARTRemove = 3000
Field Value
Type | Description |
---|---|
System.Int16 |
CQREFSTARTUpdate
Declaration
public const short CQREFSTARTUpdate = 4000
Field Value
Type | Description |
---|---|
System.Int16 |
Properties
Query
Query text.
Declaration
public string Query { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Values
Query values.
Declaration
public Hashtable Values { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Hashtable |
Methods
Equals(Object)
Compares two instances of ContinuousQuery for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean | true if both ContinuousQuery instances are the same. Otherwise false. |
Overrides
GetHashCode()
Compoutes the hash code for the current object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash code for the current object |
Overrides
RegisterAddNotification(ContinuousQueryItemAddedCallback)
Registers notification for item added in ContinuousQuery resultset.
Declaration
[Obsolete("Use RegisterCQ(QueryDataNotificationCallback callback,EventType eventType,EventDataFilter datafilter")]
public void RegisterAddNotification(ContinuousQueryItemAddedCallback itemAddedCallback)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQueryItemAddedCallback | itemAddedCallback |
RegisterClearNotification(ContinuousQueryClearCallback)
This method registers a custom callback that is fired if dataset of a continous query is cleared
Declaration
public void RegisterClearNotification(ContinuousQueryClearCallback callback)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQueryClearCallback | callback | A delegate to register your custom method with |
Examples
/// First create an CacheClearedCallback
public static void CacheCleared()
{
...
}
Then declare your continous query
ContinuousQuery cQ=new ContinuousQuery(query,Hashtable vals);
Then register your notification callback
cQ.RegisterClearNotification(new ContinuousQueryClearCallback(CacheCleared));
RegisterNotification(QueryDataNotificationCallback, EventType, EventDataFilter)
This method registers a custom callback that is fired on change in dataset of a continous query
Declaration
public void RegisterNotification(QueryDataNotificationCallback callback, EventType eventType, EventDataFilter datafilter)
Parameters
Type | Name | Description |
---|---|---|
QueryDataNotificationCallback | callback | A delegate to register your custom method with |
Alachisoft.NCache.Runtime.Events.EventType | eventType | Describes whether the event is to be raised on Item Added, Updated or Removed |
Alachisoft.NCache.Runtime.Events.EventDataFilter | datafilter | This enum is to describe when registering an event, upon raise how much data is retrieved from cache when the event is raised |
Examples
/// First create an ItemCallback
ItemCallback(string key, CacheEventArg e)
{
...
}
Then declare your continous query
ContinuousQuery cQ=new ContinuousQuery(query,Hashtable vals);
Then register your notification callback
cQ.RegisterNotification(new QueryDataNotificationCallback(ItemCallback),EventType.ItemAdded, EventDataFilter.None);
RegisterRemoveNotification(ContinuousQueryItemRemovedCallback)
Registers notification for item removed from ContinuousQuery resultset.
Declaration
[Obsolete("Use RegisterCQ(QueryDataNotificationCallback callback,EventType eventType,EventDataFilter datafilter")]
public void RegisterRemoveNotification(ContinuousQueryItemRemovedCallback itemRemovedCallback)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQueryItemRemovedCallback | itemRemovedCallback |
RegisterUpdateNotification(ContinuousQueryItemUpdatedCallback)
Registers notification for item updated in ContinuousQuery resultset.
Declaration
[Obsolete("Use RegisterNotification(QueryDataNotificationCallback callback,EventType eventType,EventDataFilter datafilter")]
public void RegisterUpdateNotification(ContinuousQueryItemUpdatedCallback itemUpdatedCallback)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQueryItemUpdatedCallback | itemUpdatedCallback |
UnRegisterClearNotification(ContinuousQueryClearCallback)
This method Unregisters the clear callback
Declaration
public void UnRegisterClearNotification(ContinuousQueryClearCallback callback)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQueryClearCallback | callback | A delegate to register your custom method with |
Examples
Lets consider we registered a ClearNotification
public static void CacheCleared()
{
...
}
Then unregister your notification callback
cQ.UnRegisterClearNotification(new ContinuousQueryClearCallback(CacheCleared));
UnRegisterNotification(QueryDataNotificationCallback, EventType)
This method Unregisters a custom callback that is fired on change in dataset of a continous query
Declaration
public void UnRegisterNotification(QueryDataNotificationCallback callback, EventType eventType)
Parameters
Type | Name | Description |
---|---|---|
QueryDataNotificationCallback | callback | A delegate to register your custom method with |
Alachisoft.NCache.Runtime.Events.EventType | eventType | Describes whether the event is to be raised on Item Added, Updated or Removed |
Examples
Lets consider we created an ItemCallback
ItemCallback(string key, CacheEventArg e)
{
...
}
Uregister your notification callback
cQ.RegisterNotification(new QueryDataNotificationCallback(ItemCallback),EventType.ItemAdded);