When you use Cache Only mode for an entity type, objects of that type behave normally when they are created during an RTC (see
Understanding 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.
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:
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).
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:
The loaded objects do not behave like newly arrived entities. They 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.