Ah true, I didnt think this through. Thanks
Wow! I’m really excited about this. Perfect timing as we were just figured out that we can’t use MessagingService for our use case and was thinking about using an external service. Much prefer to use something native to Roblox.
I’ve read the allOrNothing
parameter description like 10 times and still don’t quite understand what it does. Can someone help me understand what this is?
It sounds like if you set it to true then it will return nil if count you asked for is greater than the amount of items it can return.
Reading into the new MemoryStoreService
, I found it difficult to figure out how it fits into my workflow without any explicit use cases. There’s way too much written about the specification, but not enough about why we’d want to use it. I would like to see the wiki page(s) updated with some code samples.
Also, how does this compare to that other messaging service we were introduced to some time ago, if both can be used for ‘low-latency, high-throughput’ data manipulation?
To be honest, this looks like a combination of MessagingService and DataStoreService. It looks cool, but probably won’t use.
This is confirmed, we will have a fix soon.
The main advantage of MemoryStore over MessagingService is the disconnect from the data living on game servers. Servers do not need to establish some way of determining and managing which server is the source of truth.
For example in a queue, MessagingService must first determine which server is going to hold the queue, and then all servers have to successfully ask which server already has the queue, and when closing that server has to successfully hand off the queue before it closes.
With the MemoryStore the queue is a seperate entitity from game servers. There will always only be one, there is no need for servers to establish who is keeping track of it or hand it off.
OrderedDataStore is persistent, MemoryStore is not. So no, the use cases are different. You wouldn’t store a ranking you intend to persist on MemoryStore since you would not be able to store all player values on it at once for 30+ days.
I should have been more clear in the post. I would of course sync the memory store data with the players datastore values and then i would assign the priority queue based off of that. Of course, like the post mentioned, I would use datastores as a single source of truth. Hopefully this makes my post more clear
If the ReadAsync finds fewer items than the count
parameter and allOrNothing
is set to true it will return all the items available. If allOrNothing
is true it will return nothing.
For example, let’s say I have a queue with 99 items, and I call :ReadAsync
with a count of 100, by default it will return all of the items that it could fine (The 99 items). But if allOrNothing
is set to true it will return nothing.
That’s a valid comparison, but the official documentation fails to make any mention of that. When we want to access a tutorial, we’d rather know in what applications this is useful in than how much memory we’re allowed to store on it at a time. I’ve been developing for well over 7 years, so you could only imagine how someone with one or two years will approach this. The first paragraph mentions general use-cases, but is nowhere as in-depth as with the DataStoreService
page.
Woah
Do you have any plans to create an API for measuring Data size?
How are we supposed to know that our data is over 1KB?
It’s extremely difficult for us to remain under the limit without any tools that can help.
-
Memory Size Quota: 64KB + 1KB ⨉ [number of users]
-
Requests Quota: 1000 + 100 ⨉ [number of users]
while we can take notes, it’s almost impossible to get that information in a live game
There's a lot of documentation and links missing on the DevHub.
MemoryStoreService:GetSortedMap
Missing from MemoryStoreService
Oh my gosh, thank you! This is definitely going to improve Ro-Chat with global server data!
Could I suggest that setting shorter expiration causes larger size limits? In my use case, I’d need the data for a max of a couple of hours. Keeping it for a month is pretty useless for me. But size may be an issue. Since the data is temporary, not sure why the size limit is smaller than DataStore’s is.
SortedMap seems to just return a sorted array by division key instead of value. As such it doesn’t get any better when applied to the Global Leaderboard. SortedMap should add a way to get an array sorted by value.
Looks promising! I hope there will be some code examples in the future. Because I am unsure how I am supposed to use this for Global Leaderboard, which has been listed a use-case in the tutorial. Scores/Ranks are usually persistent so I would need to rely on DataStoreService anyhow. I don’t see how I would use MemoryStorage for a Global Leaderboard.
I’ve used this method to measure the size of my datastores previously. It returns the length or how many letters is in the json string and each letter is about 1 byte.
print(#HTTPService:JSONEncode(table))
print(string.len(HTTPService:JSONEncode(table)))
I’m assuming the example use case was if someone doesn’t use OrderedDataStores for global leaderboards. For example, a game can make a global leaderboard/ranking system based on Letters (A, B, C, etc) instead of numbers.
Id like to thank all the staff members who worked on this. Huge respect!
This has a lot of use cases and it’s great to switch to MemoryStore instead of using MessagingService for cross server communication.