Class · inherits Instance
MemoryStoreQueue
Provides access to a queue within MemoryStore.
About MemoryStoreQueue
Provides access to a queue within MemoryStore. A queue is a data structure that provides temporary storage for arbitrary items (up to the maximum item size -- see MemoryStore Limits). Each queue item has a numeric priority: MemoryStore retrieves items with higher priority from the queue first, and it retrieves Items with the same priority in order of addition.
Items in the queue can optionally be set to expire after a certain amount of time. Expired items simply disappear from the queue as if they were never added.
Methods 4
AddAsync
(value: Variant, expiration: int64, priority: double = 0) → ()YieldsAdds an item to the queue.Adds an item to the queue with the given priority and expiration. Items with a higher
priorityare retrieved from the queue before items with a lower priority, and items with the same priority are retrieved in the order they were added;prioritydefaults to 0. Theexpirationvalue, in seconds, sets how long the item remains in the queue before it is automatically removed. This method yields until the item has been added.GetSizeAsync
(excludeInvisible: boolean = false) → intYieldsGets the size of the queue.Returns the number of items currently in the queue. By default the returned count includes invisible items -- items that have been read with
MemoryStoreQueue.ReadAsyncbut not yet removed and whose invisibility timeout has not expired. Set theexcludeInvisibleparameter totrueto omit these items from the count; it defaults tofalse. This method yields until the size is retrieved.ReadAsync
(count: int, allOrNothing: boolean = false, waitTimeout: double = -1) → TupleYieldsReads one or more items from the queue.Reads one or more items from the queue as a single atomic operation.
This method does not automatically delete the returned items from the queue but makes them invisible to other ReadAsync calls for the period of the invisibility timeout. The items must be explicitly removed from the queue with
MemoryStoreQueue.RemoveAsyncbefore the invisibility timeout expires. The invisibility timeout defaults to 30 seconds unless a different value was provided inMemoryStoreService.GetQueue.RemoveAsync
(id: string) → ()YieldsRemoves an item or items previously read from the queue.Removes an item or items previously read from the queue. This method uses the identifier returned by
MemoryStoreQueue.ReadAsyncto identify the items to remove. If called after the invisibility timeout has expired, the call has no effect.
MemoryStoreQueue also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.