ListKeysAsync is harshly limited, or am I doing something wrong?

Hi. I’m planning on save slots as a new feature for my game. I’m trying to understand a good way to do this given my use-cases. I originally was going to have one data store with a few values, such as difficulty & name, so I could show this information to the player before they choose their slot.

The problem here is while this would’ve worked and this information would never change, making my system a lot easier to manage, I’ve realized that there’s a few more values I may need which change all the time when a save slot would be loaded in (levels - this stat changes basically constantly, and can be stored up to 1e303).

I thought of the new data store v2 APIs, such as ListKeysAsync, and was thinking that would be the perfect method. I could list my keys for a certain user (user_[userid]/[saveid]), and then use the prefix feature to list individual saves.

I soon came to realize that this API can only be used two times / minute / player… two times per minute… Which on its own would be totally doable - I could just set the max key count to something like 50 so I’d be able to let players create up to 100 slots if they really wanted to for whatever reason.

My issue is that this API seems to not return up to the amount given. I made up to 1000 saves, and then requested the prefix like so:

DataStore:ListKeysAsync("user_111334263/10")

image

Most of the time getting the current page for this only returns one key at a time. If I understand correctly, that’d only yield me two keys per minute which is absolutely insane and not doable. Sometimes it’ll return about 6, the most I’ve gotten is 30 would would work, but again it’s really inconsistent and I’m not sure why.

Is there any way around this? I assumed this API was meant for use in an actual game and not just stuff like GDPR removal, hence the DevHub page giving different profiles as a use case, but unless if I’m doing something very wrong, this doesn’t seem right.

There’s also the problem of it giving me keys which have been since deleted, and it seems to apply to the page limit I give it.

Ideally - I just need some way to be able to store up to 50-100 save slots, with up to no more than ~200 characters needing to be accessed for each key. Another more ideal solution would be appreciated as well, as maybe I shouldn’t be using this API if I need to access individual information on each of them?

Thank you.

1 Like

Does changing it to this:

DataStore:ListKeysAsync("user_111334263/10", 100000)

do anything?

or you can do this: DataStore:ListKeysAsync(“user_111334263/10”, math.huge) – entirely your option as your game may or may not exceed 1M Keys, Edit: This might break idk

1 Like