Hi Creators,
We are excited to announce that you can now view Data Store error messages in real-time on the Error Report Dashboard to debug issues. Additionally, you can opt-out of using the cache in GetAsync to fetch the latest data immediately.
New Error Reporting
Firstly, Data Store errors that occur in your experiences are now reported on the Error Report Dashboard. For each error, a debugging message will be published to the Dashboard in the following format: “DataStoreService: < Error Name >: < Error Message >. API: < API Name >. Data Store: < Data Store name >.”
You can access the Error Report Dashboard by visiting your Creator Dashboard > Creations > Select an experience > Error Report. On the Error Report dashboard, you can view which errors occurred over time, and even filter for specific error names, APIs, and Data Stores with the search feature! For a full list of Data Stores error codes and messages, please refer to the Data Stores Engine guide.
The messages are reported continuously in real-time, so you can get insight into how your experience is using Data Stores even if errors occur when you are offline. We hope this will help you better understand how your experience is interacting with Data Stores, and solve bugs when they show up!
GetAsync Cache Opt-Out
When you use Data Stores, values that you retrieve with GetAsync are stored in the local cache for 4 seconds. By default, GetAsync requests for keys stored in the cache will return the cached value instead of continuing to the backend. Most of the time, this is useful, because GetAsync requests that return a cached value respond faster and do not count towards your server or throughput limits.
However, since GetAsync caches the data for 4 seconds, this can cause issues if you’re trying to keep data perfectly in sync between multiple servers. Previously, you were unable to opt-out of using this cache, meaning that you had no way to get the most up-to-date value except for waiting 4 seconds for the cache to expire. Now, you can opt out by specifying a new DataStoreGetOptions parameter.
Example code:
local DataStoreService = game:GetService("DataStoreService")
local experienceStore = DataStoreService:GetDataStore("PlayerExperience")
-- Create a DataStoreGetOptions instance to specify your desired cache behavior
local getOptions = Instance.new("DataStoreGetOptions")
getOptions.UseCache = false
local success, currentExperience = pcall(function()
-- Specify your options as a parameter on GetAsync
return experienceStore:GetAsync("User_1234", getOptions)
end)
if success then
print(currentExperience)
end
Note: If you do not specify a DataStoreGetOptions parameter, your GetAsync code will maintain the current behavior, which is to return the cached value if it exists.
Opting out the cache can be useful if you have servers updating shared keys frequently and always need to get the latest value from Roblox servers. However, please note that bypassing the cache may cause you to consume more server and throughput resources since requests that bypass the cache will always count towards your Data Stores server and throughput limits. To minimize your throughput usage, we recommend that you opt out of using the cache only if you have keys that may be updated by multiple servers and you need to get the latest value as soon as possible!
We hope this feature will give you more freedom to create experiences with Data Stores. Please let us know if you have any feedback. We’ll keep improving our services to better serve your needs.
Thank you,
The Roblox Creator Services Team