Caching of display methods has been introduced to improve the performance of display and edit functions if they are calculated on the AOS, and to improve the performance when records are transferred from the server to the client.
Signing up methods for caching
Only methods that are explicitly added to the cache are affected by the new caching mechanism. To sign up a method for caching, the method cacheAddMethod on the form datasource should be called after super() in the init method of the datasource.
The call to cacheAddMethod also determines how often the cached display method value is updated. The value is filled in on fetching data from the back-end, and it is refreshed when reread is called on the datasource. Furthermore, by default the display method values are also updated when the record is written to the database, but that can be changed using the _updateOnWrite parameter in the cacheAddMethod.
Only display methods that are of display type can be cached, i.e. edit-methods cannot be cached
The cacheAddMethod signs up the specified display method for caching. The cached methods are calculated on fetching data, and the calculated values are then passed to the client together with the data. The cached values are refreshed on reread, and by default, on write and create.
public boolean cacheAddMethod(str _methodName, boolean _updateOnWrite)
Returns: TRUE if the method was signed up successfully, otherwise FALSE
_updateOnWrite: Determines whether the cached value is updated automatically when the record is written. Default value is TRUE.
This method should be called after initialization of the datasource, but before any data is fetched. Hence the call to this method should be placed after the call to super() in the init method.
The _updateOnWrite parameter also determines if the display method value should be calculated and cached when a new record is created. To manually update the cached value for the display method, call the cacheCalculateMethod method.
Only methods with the display keyword can be cached. Furthermore, only table methods can be cached, i.e. methods written on the form or the form datasource cannot be cached. Use the tableMethodStr function to get a compile check as to whether the method exists.
Do not sign up display methods that are not used on the form - they will be calculated for each record even though the values are never shown.
public void Init()
On a form having custtable as a datasource, you might find this in the init method of the datasource