Cache Only And Store Only Objects in the Rete Network
When you use cache only or store only mode for an entity type, objects of that type behave normally when they are created during an RTC (see Conflict Resolution and Run to Completion Cycles for more details). At the end of an RTC, however, they are removed from the Rete network and written to the cache or store.
Cache Load Functions
You must explicitly load Cache Only objects into the Rete network when they will be needed during an RTC, using an appropriate cache load function in the
DataGrid
function category, within the
Cluster
category.
For details about the catalog functions, see TIBCO BusinessEvents Functions Reference.
The functions that load concepts by
ExtID
or
ID
have a parameter to control whether contained concepts are also loaded. The
CacheLoadParent()
function, which loads a given concept’s parents, has the option to return all parents or the immediate parent. (Parents are concepts related to the given concept by a containment relationship).
- If the referenced concept will be used in a rule agenda in working memory, you must explicitly load all referenced concepts as needed since only containment relationships can be handled automatically.
- If the referenced concept will not be used in a rule agenda in working memory and only the concept's property will be referenced, then it is not necessary to explicitly load the concept.
A general best practice is to use these functions in an event preprocessor. Event preprocessors are multithreaded so performance is better. Also, if you load the objects in the preprocessor, then the rules themselves do not have to take account of the need to load the objects during execution. For example, in the preprocessor, you could preload an order concept using an
ExtID
available in the event as follows:
Concepts.Order order = Cluster.DataGrid.CacheLoadConceptByExtId(orderevent.Order_Id, false);
Loaded Objects
Loaded objects do not behave like newly arrived entities and do not trigger rules.
The loaded objects are not asserted: their presence alone does not trigger rules. They are simply restored to the Rete network. They behave as if they had never been removed. For example, rules do fire if there is a join condition between the entity loaded from cache and another entity that is asserted or modified in the same RTC.
Also if you modify the object that you reloaded, it can trigger the rule.