How would I perform two datastore requests at once

basically is there a way to do two set requests at once to noT hit the limit datastore. Basically two requests in one api call

Try using DataStore2 (30 chars)

1 Like

datastore 2 doesn;t allow this either, my goal is to fetch two datas from a datastore at 1 call. I know I could just put my data in a table but theres a reason I can’t do this

1 Like

You can’t perform two requests in one go. However, if you combine your DataStores into one table DataStore, containing all of your values, you can get/set all of your data at once.

1 Like

Don’t use 2 data stores, just change the keys for the player.

1 Like

I believe he meant the DataStore2 module, not two separate DataStores.

1 Like

yah just whast I was about to say, the reason I can’t do is I have a system of private chats in games, a pesron can create a private chat group and anyone can talk on it from any server, right now this works BUT for multiple chat groups I would have to perform multiple requests. If I combined all the private chat group messages in one key that limit for that key would be 300k characters which means all the private chats in my games have to have all there messages fit under 300k, and each group can do 50 posts until the older posts start getting deleted. If each person has a limit of 100 characters times 50 posts, would mean each private grop can have 5k characters. And that means the max private chats my game can have is 60, which isn’t much

1 Like

I’m not quite sure I understand. So basically you are trying to split up your chat data into two DataStores, because you max out the limits on the one?

1 Like

Ok let me get the gramely on lol. This is what Im sapying. I have a system where a user can create a private chat with his friends. and the friends can talk in this private chat from any server. This is already implemented easily. These private chats are stored on a datastore so if the person int he private chat joins later, the server just gets the data from the datastore and loads it up. the way I’m saving my chats into the datastore is using a que system. Every 7.5 seconds a while loop runs. if the que is not empty it adds the new messages to the datastore using updateasymc. Now the problem with this is it works fine with a low amount of private chats. But with 5 I would have to perform a datastore save request for each party inside the datastore. The idea you said wasn’t bad but the problem is it limits all the private parties to having all of there 50 posts combined in only 300 thousand cahracters. Once the post count goes to 50 the older posts get deleted. Even with 50 max posts this isn’t really good

I could add a save each time the player chats but thats horrbily inefficient

1 Like

Why would you, thats a VERY bad and inefficent idea you dont need more the one

1 Like

i dont think you get what im saying i’m saying performating a request which a datastor gives back the values of both keys, i’m not saying performaing two api requests to a database, just one but that one returns both indexes

At the moment, you can only perform a single call. There was a plan discussed during RDC to allow for batch requests to be performed so you can save multiple keys at one time. You can view the keynote, as well as that specific topic, here:

1 Like

do you think it will be released this year? this is exactly what I was asking thanks

Within this year or next is the aim but not the guarantee. This was included in the “What’s Coming Up Next Year” section of the presentation.

I don’t believe it extends to your specific use case of fetching multiple keys at once, you may still have to do that manually (and it’s better it stays that way as well). Batch requests are more applicable to writing so that you can perform everything at one go (atomic operation IIRC).

1 Like