A way to reset memorystore?

hi in a game there is a certain memory store map thats filling the quota that has keys thatll expire in a WEEK and i have no idea what the keys are as roblox doesn’t provide a way to read/write on memory store maps by whole (as far as i know). i need urgent help or else for a week straight the memory store quota will be filled and my game wont work for a whole week. I need to reset it. Is there any way to do it?

why not just set the values to nil?

[i have no clue how to use memorystores so im probably wrong]

1 Like

Without knowing the keys, u can’t set values to nil

just change the store key, MemoryStore:GetSortedMap(" this is a new empty store")

Changing the key doesnt reset the old memorystore


How delete all data:

Sorted Map
Queue
HashMap

Never said it does? I’m guessing he just wants an empty store, therefore you can just change the store key, that’s how people clear datastores.

Also you do realize this has to be a script that’s executed during runtime?

Super important keyword: filling up the quota

Go in a teamtest server (or a real server) and paste the code to the console

You can literally just set expiration time in seconds to your key, after that the key will automatically be removed. You can keep the key alive by marking it alive.

--// Keep the key alive while server is on
task.spawn(function()
    while true do
       MemoryStore:SetAsync(someKey, someValue, 60)
       task.wait(45) 
    end
end)

You’re right, however this has nothing to do with the current thread.
The OP (accidentaly) created keys that would expire in 1 week that are filling up all of the quota of the experience, and asking help on how to reset all data in a memory store, not asking how to change the lifetime of new data thats being written

Just saying, if the OP knew how to use MemoryStore properly, this wouldn’t have happened.
Using a new Memory Store is still faster and doesn’t cost anything, since the keys are temporary.

Using a new memory store doesn’t fix anything, the quota is experience based, all memory stores inside an experience use the same quota

Roblox Documentation:
After your experience hits the memory size quota, any API requests that increase the memory size always fail. Requests that decrease or don't change the memory size still succeed.

Keywords: “experience”, “always”

Keywords: “quota applies to all memorystoreservice api calls”

Keywords: “experience level”, “not server level”

How does one manage to create a huge amount of accidental keys, to a certain point where the store needs to be cleared bruh

Accidents can happen sir. It was my first time using memorystores.

1 Like

pretty crazy to be typing when you have no idea what you’re typing lol

  • You can’t just use a new SortedMap and expect the old ones to magically disappear - at least not until a week.
  • Every entry inside your MemoryStores in an experience counts towards a quota, it doesn’t care what MemoryStore set you are changing here.
  • Mistakes do happen, and sometimes it’s beyond your control. I’m not sure why OP is being grilled for it.

Rebuttal aside:

You can clear SortedMaps, even if you don’t know their keys - you just need to know what SortedMap is being affected.

Loop through the results of GetSortedAsync (which will get you the keys being used), and call RemoveAsync using the keys that were retrieved.

There’s also the option of just not writing to those keys for a week - but seeing how you’re making a thread here, I think whatever issue you have is pretty urgent.

Also, look up documentation for exact code. This is just a guide.

2 Likes

Hey, sorry I’m late to the party. Anyone having a similar issue in the future can use Open Cloud to ‘flush’ all data from their experience’s memory stores.

Here’s the documentation: https://create.roblox.com/docs/cloud/reference/MemoryStore#Cloud_FlushMemoryStore

You’ll need to create an API Key (send it under the header x-api-key) with permission to flush memory stores. It’s a little advanced if you’re not familiar with HTTP requests, and it’s unfortunate Roblox doesn’t include a button on the creator dashboard or allow you to do it using HttpService in Studio. If you have Python on your computer, this snippet should work for you:

import requests

universe_id = 0 # insert your game's experience ID here
api_key = "" # the API key you generatored from the creator dashboard

r = requests.post(
    f"https://apis.roblox.com/cloud/v2/universes/{universe_id}/memory-store:flush",
    json={}, headers={"x-api-key": api_key}
)
print(r.status_code, r.text)
6 Likes

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