It is important during planning phases to understand the effect of using cache-only cache mode at runtime, so that you can design your projects accordingly.When you use the cache only mode for an entity type, entities of that type are asserted into working memory in the usual way when created. However when they are no longer needed (at the end of an RTC), they are removed from working memory. You must explicitly load the instances back into working memory when they are needed, so that they are available to the rule engine.The following functions are available for the purpose of loading cache-only objects into working memory. The functions are in the Coherence function category and they are as follows:The functions that load concepts by ExtID or ID have a parameter to control whether contained concepts are also loaded. The function for loading a given concept’s parents has the option to return all parents or the immediate parent (that is, concept or concepts related to the given concept by a containment relationship).A general best practice is to use these functions in an event preprocessor. If you do so 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 = Coherence.C_CacheLoadConceptByExtId(orderevent.Order_Id, false);
It is not always necessary to explicitly assert an object into working memory in order to work with it. For example, you can use getbyextId() to retrieve a local copy of the object from cache and use information in the object for calculations (or other uses) in a rule.
If the entity instance is not found in working memory or cache, your application logic determines what to do next, for example, create a new instance of that entity type.After the object is asserted into working memory from the cache, other rules in the same RTC that depend on that object can then execute. At the end of the RTC, all cache-only objects are removed from working memory.
Copyright © TIBCO Software Inc. All Rights Reserved.