Hi. I’d like to keep record of total matches played by users. Use case at start is mainly to give rewards every 5 matches played and maybe some later veteran bonuses etc.
Would better pattern be to save count per user in storage or should I create “incr” leaderboard containing all my users?
After some thinking I’ll probably go with storage engine as moving data from there to leaderboard list is probably easier direction if I change my mind later.
I think either approach is valid, it boils down to use whatever best fits your use-case, there’s pros and cons to either choice:
The leaderboard API is optimised to list the results in the leaderboard order, which might prove useful if you intend to rank players based on match count or something similar.
Using the incr operator it’ll atomically update the score in a single operation, but you could also achieve this in the storage engine with some custom SQL.
The storage engine should be more flexible, if you already store some player data in an object I’d suggest you store it there, it is better to have larger storage objects than to fragment data across a lot of smaller ones.
Hope this helps
Thanks. I’ll collect other similar stats for players too so storage engine is better choice here.