1. Gregory Rusak
  2. PowerBuilder
  3. Thursday, 30 July 2020 20:44 PM UTC

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

Accepted Answer
Arthur Hefti Accepted Answer Pending Moderation
  1. Friday, 31 July 2020 04:03 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi

as you said, the function of_GetRegistered returns a reference to the cached datastore, so there's no need to create lds_Temp, set dataobject or transaction and destroy it.

Do a of_GetRegistered() and e.g. ShareData().

Regards
Arthur

Comment
  1. Gregory Rusak
  2. Friday, 31 July 2020 04:39 AM UTC
Thank you Arthur! That's what I was missing. And when the PFC service gets destroyed so to will all the cached datastores.



Appreciated.
  1. Helpful
There are no comments made yet.
Gregory Rusak Accepted Answer Pending Moderation
  1. Friday, 31 July 2020 01:03 AM UTC
  2. PowerBuilder
  3. # 1

Thanks John.

In your own words, "it's not much", and unfortunately does not help.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 31 July 2020 00:38 AM UTC
  2. PowerBuilder
  3. # 2

Hi, Greg -

I was able to find a little documentation on the use of the DW Cache service:

It's not much, but I hope it helps.

John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.