Cache Only Objects in the Rete Network

When you use cache 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.

Note: Ensure you use correct locking before loading objects.

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:

CacheLoadConceptByExtId()
CacheLoadConceptsByExtId()
CacheLoadConceptById()
CacheLoadEventByExtId()
CacheLoadEventById()
CacheLoadParent()

Less-commonly used:

CacheLoadConceptByExtIdByUri()
CacheLoadConceptIndexedByExtId()
CacheLoadEntity()
cacheLoadEventByExtIdByUri()
loadConceptUsingExtId()

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).

Note: Referenced Concepts:
  • 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);