question

usachovdailymagic avatar image
usachovdailymagic asked

Is there safe read from titleData?

Is it possible to GetTitleInternalData like SELECT...FOR UPDATE from mysql?
I want to read field from internal title data, make increment for one field and thean call SetTitleInternalDat. But this field can be overriden by old value from another session of players request.
I just need to do increment with integer value. May be there is any other place to do it safely?

Thanks!

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

·
brendan avatar image
brendan answered

Title Data is a sharded and cached resource, as it must be readable by all players in the service - meaning it could be servicing thousands of requests simultaneously. As such, it should be only infrequently updated, and must never be updated from a client action. And because it is cached in multiple instances, an update to it does not update all caches instantly - there will always be a small lag time between when you update it and when that new data is available in all caches.

For an integer you want to increment for each player, we would recommend a Redis int.

4 comments
10 |1200

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

usachovdailymagic avatar image usachovdailymagic commented ·

You mean I should use external service. Or there is a redis feature in playfab?

0 Likes 0 ·
brendan avatar image brendan usachovdailymagic commented ·

Sorry, to be clear, that would be as an external service.

0 Likes 0 ·
usachovdailymagic avatar image usachovdailymagic commented ·

I think I can use statistics table with "Aggregation method" mode "Sum". But I need to use custom users for increment.

0 Likes 0 ·
brendan avatar image brendan usachovdailymagic commented ·

No, you cannot use a single player account's statistic as a way to aggregate data across all users. Please believe me, if we had a valid workaround you could use for this, we would have called it out already.

0 Likes 0 ·

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.