Wednesday, August 8, 2007

Caching of display methods

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.

Example 1

public void Init()





On a form having custtable as a datasource, you might find this in the init method of the datasource


Anonymous said...

Can anyone recommend the best Network Monitoring program for a small IT service company like mine? Does anyone use or How do they compare to these guys I found recently: [url=] N-able N-central configuration management
[/url] ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Anonymous said...

I truly believe that we have reached the point where technology has become one with our society, and I am fairly certain that we have passed the point of no return in our relationship with technology.

I don't mean this in a bad way, of course! Societal concerns aside... I just hope that as the price of memory falls, the possibility of transferring our brains onto a digital medium becomes a true reality. It's one of the things I really wish I could experience in my lifetime.

(Posted on Nintendo DS running [url=]R4i SDHC[/url] DS Ting2)

Anonymous said...

hip hop pendants [url=]hip hop jewelry[/url],[url=]hip jump pendants[/url],alert short trip watches,[url=]bling bling[/url] ,hip hop,[url=]hip dance chains[/url],hip caper bling,[url=]iced visible chains[/url],[url=]wholesale chains[/url]
hip hop jewelry