Datastores: caching cooldown has wrong value in documentation

https://www.robloxdev.com/api-reference/function/GlobalDataStore/GetAsync

Caching cooldown is documented as 4 seconds, but it is actually 5.

Run following code to confirm. Datastore budget never decreases since the loop interval is less than 5 seconds:

local data = game:GetService("DataStoreService"):GetDataStore("Test")

for i = 1, 10 do -- I would expect this block to consume 10 requests every 4+ seconds (incl GetAsync yield time)
   spawn(function()
      while wait(4) do
         data:GetAsync("TestKey"..i)
      end
   end)
end
1 Like

If you run this with 5 seconds, does budget decrease?

Yep

image

(Oops I left that running in the background)

1 Like

Perhaps they say it’s four to prevent people running get requests at once per 5 seconds since it decreases the budget, if that’s the case this should be documented nevertheless.

Based on a chat I had it appears to me that they changed the threshold and the documentation never got updated, and they copied over the wrong value when they moved to the Hub. But it could also be that!

2 Likes