I must be missing something with the PFC caching service (pfc_n_cst_dwcache).
There's very little documentation on the service, so I'm hoping someone has used it before and explain how it is to be used.
What I don't understand is if you destroy a datastore that was loaded with data from the cache, it also destroys the cached datastore object as well.
For example, if you start the service on the app manager, register a datastore object with it, then in another window, get the contents of that cached datastore and then destroy the local datastore it was loaded into, it destroys the cached datastore and you can no longer get data out of it.
I can understand this happens because the call to of_GetRegistered returns a "reference" pointer to the cached datastore. So how does this work and what is the fundamental thing I'm missing?
Code
// Start the cache service
gnv_app.of_setdwcache(TRUE)
// Cache a datastore
n_ds lds_d_dddw_ontology_title_pick_list
lds_d_dddw_ontology_title_pick_list = CREATE n_ds
lds_d_dddw_ontology_title_pick_list.DataObject = 'd_dddw_ontology_title_pick_list'
IF lds_d_dddw_ontology_title_pick_list.of_SetTransObject(sqlca) < 0 THEN
PopulateError(100, 'Unable to SetTransObject')
gnv_app.of_app_error()
RETURN
END IF
ll_rowcount = lds_d_dddw_ontology_title_pick_list.Retrieve()
IF ll_rowcount > 0 THEN
gnv_app.inv_dwcache.of_Register("d_dddw_ontology_title_pick_list", lds_d_dddw_ontology_title_pick_list)
END IF
// Get cached data
n_ds lds_temp
lds_temp = CREATE n_ds
lds_temp.DataObject = "d_dddw_ontology_title_pick_list"
IF lds_temp.of_SetTransObject(sqlca) < 0 THEN
PopulateError(100, 'of_SetTransObject failed')
gnv_app.of_app_error()
RETURN FAILURE
END IF
gnv_app.inv_dwcache.of_GetRegistered("d_dddw_ontology_title_pick_list", lds_temp)
DESTROY lds_temp
// At this point since lds_temp is passed by reference, you can no longer get any cached data for "d_dddw_ontology_title_pick_list" in any other Window.
PowerBuilder 2019R2 Build 2082
Thanks in advance for having a look.
Regards,
Greg
Appreciated.