| Home | Previous Lesson: Transaction Registration Service Next Lesson: Most Recently Used Object Service |
In some situations, you may need to minimize the database access and so store the retrieved data in the memory for future access in the application. In such cases, you can use the PFC�s DataWindow chatting services. PFC uses DataStores internally to cache the DataWindow�s data. As usual, you need to turn on the DataWindow caching service:
gnv_app.of_SetDWCache(TRUE)
Then, you need to register the DataWindow that needs to be cached by calling the of_Register() function. This is an overloaded function. Call with appropriate arguments depending on the caching type, as explained below:
Call of_IsRegistered() function to check whether or not the DataWindow is cached. To use the cached data, you need to first call of_GetRegistered() function and then share the data. For example:
gnv_app.inv_dwcache.of_GetRegistered(&
"d_products_maint",ids_datastore)
ids_datastore.ShareData( dw_product)
The above example is using an instance variable ids_datastore to point to the cached data and the actual DataWindow is sharing the data from the DataStore. If you are using the first method to cache the data, i.e., when the cache service is used to retrieve & cache the data, you can ask the cache service to retrieve the data by calling of_Refresh() function. Even though you need not turn off the DataWindow cache service explicitly, we advise you to turn off the service as soon you are done with it.
| Home | Previous Lesson: Transaction Registration Service Next Lesson: Most Recently Used Object Service |