Functions : Guidelines for Use of Coherence (Cache Query) Functions

Guidelines for Use of Coherence (Cache Query) Functions
Various functions in the Coherence category enable you to work with objects in the cache. Query functions work with content in the cache. Cache load functions load items into the Rete network so they are available.
Tool tips in the user interface (and reproduced in the TIBCO BusinessEvents Functions Reference) explain the details of how to use the functions. This section explains the context of use and highlights certain patterns of use.
Coherence Category
Functions for Loading Entities to Rete from Cache and Backing Store
C_CacheLoadConceptByExtId
C_CacheLoadConceptsByExtId
C_CacheLoadConceptById
C_CacheLoadConceptsById
C_CacheLoadEventByExtId
C_CacheLoadEventById()
C_CacheLoadParent()
C_CacheLoad*() functions are required for working with cache only cache mode. They load entities from the cache (or backing store if not found in the cache) into the Rete network. See Loading Cache-Only Objects into the Rete Network in TIBCO BusinessEvents Architect’s Guide for details.
Use the C_CacheLoad*() functions in an event preprocessor. Only use them in rules for cases where the ID or ExtId is not known in advance (in the preprocessor).
After cache-only concepts are loaded in this way, you can then use Instance.getByExtId() in rules.
Never use Instance.getByExtId() unless you have first loaded the concept. Instance.getByExtId() does not assert the concept but just returns it for use in rules, for example, as read-only reference data.
Locking Functions
C_Lock()
C_UnLock()
In the event preprocessor, use the C_Lock() function to prevent other threads or engines from operating on the same entity. The lock is automatically released at the end of the RTC.
Use C_Unlock() only in a preprocessor and only to handle cases where you need to release the lock, for example because some information is missing that would be required to go forward.
See Using Locks to Ensure Data Integrity Within and Across Agents in TIBCO BusinessEvents Architect’s Guide for details on use of locks.
Indexing Function
C_Index() creates an index on the specified property, which is useful when you run queries.
Specialty Functions Not for General Use
The following functions are used only in certain custom applications and are not for general use.
C_CacheLoadConceptIndexedByExtId()
C_CacheLoadEntity()
C_CacheReevaluate()
C_EnableCacheUpdate
Constants and Extractors Categories
Constants and Extractors functions 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.