Memory Store UpdateAsync with expiration set to 0

When using DataStore if we use GlobalDataStore:RemoveAsync it will return

but when using MemoryStoreSortedMap if we use MemoryStoreSortedMap:RemoveAsync it will return

so I came up with the idea of doing

local priorValue = nil
sortedMap:UpdateAsync("Key", function(value)
	priorValue = value
	return "will other servers ever see this value?"
end, 0)

as you can see from the code above I set the expiration to 0 so I’m curious to know if the key will be instantly deleted or is there a very small chance that another server could read the same key before the expiration removes itself

if its not instantly deleted its still not a problem I could prevent myself from reading the incorrect value by doing this but I would still like to know 100% what is going on behind the scenes

local priorValue = nil
sortedMap:UpdateAsync("Key", function(value)
	if value == nil or value == "" then return nil end
	priorValue = value
	return ""
end, 0)

thanks for your help :slight_smile:

1 Like