Creator Store: [Link]
An implementation of a Distributed Memory Store Sorted Map. I made this as a scalable alternative to the default Memory Store Sorted Map, allowing creators to define the number of "partitions". Each partition, under the hood, is actually its own sorted map, but the module orchestrates it so they act as a single map.
To use a Distributed Sorted Map:
- Import the module with
local MemoryStoreDistributedSortedMap = require(<path to script>.MemoryStoreDistributedSortedMap)- Create a map with
MemoryStoreDistributedSortedMap(name: string, numPartitions: number?)| Parameter | Description |
|---|---|
name: string |
The name of the sorted map. |
numPartitions: number? |
The number of the partitions to create in the sorted map. If not provided, defaults to 16. |
After getting a Distributed Sorted Map, the method interface is completely backwards compatible with a
regular Memory Store Sorted Map - see
API. This module adds extra functionality to a single method - GetSizeAsync.
MemoryStoreDistributedSortedMap:GetSizeAsync(approximate: boolean?, numPartitionsToApproximate: number?)| Parameter | Description |
|---|---|
approximate: string? |
If the size should be approximated. If false or not provided, it will not approximate, and will scan all partitions. |
numPartitionsToApproximate: number? |
The number of the partitions to sample, if approximate is true. If not provided, defaults to 1. |
Example:
local MemoryStoreDistributedSortedMap = require(game.ServerScriptService.MemoryStoreDistributedSortedMap)
local map = MemoryStoreDistributedSortedMap("myMap", 100)
map:SetAsync("exp", 5, 300)
print(map:GetAsync("exp"))| Limit Type | Limit |
|---|---|
# Items |
~ numPartitions * 100000 |
Size |
~ numPartitions * 100 kb |
| Function | Request Unit(s) |
|---|---|
GetAsync() |
1 |
GetRangeAsync() |
<numPartitions * count |
GetSizeAsync() |
numPartitionsToApproximate or numPartitions |
RemoveAsync() |
1 |
SetAsync() |
1 |
UpdateAsync() |
>2 |