So I've been reading this article on the wiki about saving player data, but something seemed a bit weird to me. (Here's the link: http://wiki.roblox.com/index.php?title=Saving_Player_Data)
In their example, they demonstrated making a save data function using only SetAsync, but in their article explicitly about the data store service (along with it's API), they say how using only SetAsync to save existing data can be dangerous, since GetAsync can return cached data.
Here's the function they gave in their article that is somewhat controversial to me:
local function savePlayerData(player)
playerData:SetAsync(player.UserId, sessionData[player]) -- SetAsync to save EXISTING data?
end
-- And now we're going to use it in a loop?
local function autosave()
while wait(AUTOSAVE_INTERVAL) do
for player, data in pairs(sessionData) do
savePlayerData(player)
end
end
end
Here's the quote from the original wiki article documenting the data store's SetAsync function:
"Sets the value of the key. This overwrites any existing data stored in the key. If the previous value of the key is important, use UpdateAsync. Using GetAsync to retrieve a value and then setting the key with SetAsync is dangerous because GetAsync sometimes returns cached data, and other game servers may have modified the key"
(Initial data store article here: http://wiki.roblox.com/index.php?title=Data_store)
So... Are there some exceptions to when you can use SetAsync to save existing data, does it not matter, or did they just make a mistake?
If anyone could clear this up for me, I'd really appreciate it. Thanks.

1 comment
It's looks like data for individual players is fine to use setAsync, but data that's used across multiple games at the same time (like total kills across everyone who's ever played) would need updateAsync to make sure nothing is lost.