Functions : Guidelines for Use of Oracle Coherence Functions

Guidelines for Use of Oracle Coherence Functions
TIBCO BusinessEvents Express  This section relates to Cache OM functionality and is not relevant if you are using TIBCO BusinessEvents Express edition.
This section is provided for those using Oracle Coherence as the cache provider. For information on using Oracle Coherence see Enabling Use of Oracle Coherence as the Cache Provider.
Constants and Extractors Categories
The Coherence category has Constants and Extractors functions which are used in conjunction with functions in the Filters category.
Extractor functions return values for properties of different types.
Constants functions wrap constants so they can be used in filter functions. For example if a filter checks for X = 10, you would first wrap 10 using C_IntConstant().
Filters Category
Functions in this category enable you to use various criteria to identify a set of objects in the cache for a query. You can pass the filter to a query function.
The C_RuleFunction() function allows you to specify a rule function containing a custom filter condition.
Query Category
Query category functions operate only on the cache  Unlike the C_CacheLoad*() functions, the query functions do not look in the backing store if objects are not found in the cache.
If a backing store is used  Do not use query functions that delete or modify values if a backing store is used. Instead use a query to return the IDs of the entities you want to delete and use Instance.deleteInstance() or Event.consumeEvent() as needed.
C_CacheInvoke()
C_CacheOnlyMode_DeleteConcepts
C_CacheOnlyMode_DeleteEntities
C_CacheOnlyMode_QueryConcepts
C_CurrentContext
C_EntryHasNext
C_EntryIterator
C_EntryNextValue
C_KeyHasNext
C_KeyIterator
C_KeyNextValue
C_QueryAction
C_QueryAndLoadConcepts
C_QueryConcepts
C_QueryEvents
C_QueryEvents_Order
C_QueryIDs
Query functions take various actions for a specified entity or set of entities. For example, C_CacheInvoke() allows you to invoke a rule function for all matching entities in the cache.
For some functions you can specify the entities by passing a filter (from the Filters category).
Tool tips in the user interface (and reproduced in the TIBCO BusinessEvents Functions Reference) explain how to use the functions singly or in combination to achieve the desired results.
The C_CacheOnlyMode*() functions are for use with entities that use cache-only cache mode.
Query Optimization
When you use Oracle Coherence as the cache provider, you can index concept and event properties to make searches faster.
The query optimization you set up is used by C_Query*() functions and by snapshot queries (available in TIBCO BusinessEvents Event Stream Processing add-on).
The snapshot query manager rewrites parts of the query’s where clause to use Coherence IndexAwareFilters. Coherence, however, may or may not use the index, depending on how complex the filter is. Complex where clauses containing function calls and joins will not be optimized. Only simple filters, such as age > 60, or name in (“a”, “b”, “c”), are re-written to use indexes.
Only query agents enabled for query optimization use this feature. You can define the indexes in two ways. Setup is explained next.
To Enable Query Optimization
In the project CDD file, add the following property to the query agent properties:
be.agent.query.enable.filter.optimizer=true
Only agents with this property set to true will attempt to use indexing that you define.
To Use Query Optimization
You can set an index on an entity property in either of two ways: using a Coherence catalog function in your code, or setting a metadata property in the project’s Cluster Deployment Descriptor (CDD) file.
Using a Coherence Catalog Function  You can define an index using the following function in your code:
void C_Index(String cacheName, Object property, boolean isOrdered)
where:
cacheName is a String returned by C_CacheName().
property is the object Returned by the appropriate C_DatatypeAtomGetter functions, for example, C_StringAtomGetter().
isOrdered is a Boolean: set to true to order the contents of the indexed information, and set to false if you want to use an unordered index.
Using a Property Metadata Setting  Do the following to create an unordered index on a property:
1.
2.
3.
In the Properties Metadata section, check the Present in Index checkbox for the property you want to index.
4.