question

joakim-kalmar avatar image
joakim-kalmar asked

Best solution for accessing TITLE INTERNAL DATA

How expensive is it to query "TITLE INTERNAL DATA" inside cloud script?
Will I be able to save a lot on query data once and store data in reusable global variables?I will then check if the global variable is NULL and if TRUE I will query data from API and store it global. Next request will then be able to access data from global variable.
Or is there nothing to retrieve because cloud script already works that way in the background?

apisCloudScriptdata
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

>> How expensive is it to query "TITLE INTERNAL DATA" inside cloud script?

Server API GetTitleInternalData can be called via server.GetTitleInternalData(request) statement directly on CloudScript.

>> Will I be able to save a lot on query data once and store data in reusable global variables?

Currently, PlayFab doesn’t provide such features can be used as reusable global variables. If you mean the global variables in CloudScript, they are unable to be assigned by CloudScript functions. Global variables in CloudScript only can be assigned manually, in a word, you need to change the CloudScript code then deploy it again if you want to change the value of a global variable. Hence, your description can’t be implemented using CloudScript global variables. A possible workaround is to use an external cache(like Redis) to store the reusable global variables.

>> Or is there nothing to retrieve because cloud script already works that way in the background?

You can't rely upon the same JS engine, or even server, to necessarily be the same from one instance of calling a handler to the next. There's a more complete discussion on this subject in this thread: https://community.playfab.com/questions/3388/210571828-JS-static-properties-and-Cloud-Script.html.

If you want to use the Title Internal Data in CloudScript, you need to retrieve them via Server API GetTitleInternalData in the corresponding function every time, or retrieve the data from an external cache.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.