Datastores: Caching on GetAsync

Currently when a script calls DataStore:GetAsync(), the result is cached for five seconds. This means that retrieving the same key within the next five seconds can return a stale result. We’ve identified this as unexpected behavior and are going to gradually reduce the local cache duration until is at zero seconds. As we incrementally lower the duration that keys are cached, we will monitor how it affects our backend.

What this means for you:
If a script in your game calls DataStore::GetAsync() more frequently than the current cache time of 5 seconds, you should expect your game to send more and more of your requests to the web to fetch the latest value of they key as we lower the cache duration. This will consume more of your allocated budget for Data Store Gets and if done too often, your game may be subject to increased throttling. Please rewrite your scripts to ensure that they do not perform too many Data Store Gets in a short amount of time. If you are following our guidelines then your game will not be negatively affected.

Expect the cache duration reduction to begin on August 17th.

48 Likes

to begin on August 17th.

What a good birthday gift :slight_smile:

6 Likes

I took me 2 weeks to figure out this myself back in 2015 (it wasn’t documented) and made me scrap what I was working on for over 3 weeks. I’m so happy this is being changed!

1 Like

seriously though datastore is getting a much needed face-lift. Thank the heavens

11 Likes

Last time that I checked :OnUpdate( ) had a “long” delay (30-60 seconds?) in receiving an event/update cross server, is this being addressed as well with the caching? Or is this solely caching on :GetAsync( )?

It is a method that can be really benificial for cross server communication or eg trading or matchmaking. But nevertheless, great update!

Has the cache duration reduction taken effect yet? Working on rewriting my DataStore scripts and was curious about the status of this.

5 Likes

i guess so?

I know that’s the date in the OP, but sometimes these sorts of changes get delayed without notice. Plus the wiki still uses out of date information (it says the cache lasts for 10 seconds), so it’s hard to know what the actual limitations are set to right now.

2 Likes

The gets are currently cached for 4 seconds.

1 Like

Will this apply for UpdateAsync pulling data from the site to be updated too, or is the reduce in caching for Gets only going to be for GetAsync?

This only applies to GetAsync.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.