MemoryStoreSortedMap
Provides access to a sorted map within MemoryStoreService.
Memory category | Instances |
---|
Member index 5
Description
Provides access to a sorted map within MemoryStoreService. A sorted map is a collection of items where string keys are associated with arbitrary values (up to the maximum allowed size -- see Memory Stores). Each item can also have an optional sort key, which can be a number or a string. In the ordering of items, the sort key, if provided, takes precedence over the key. Items with numeric sort keys are sorted before items with string sort keys, which are sorted before items with no sort key. Items with the same sort key and items with no sort key are arranged in alphabetical order by key.
History 16
- 600 Change ReturnType of UpdateAsync from Variant to Tuple
- 600 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int64) to (key: string, value: Variant, expiration: int64, sortKey: Variant)
- 600 Change Parameters of GetRangeAsync from (direction: SortDirection, count: int, exclusiveLowerBound: string = , exclusiveUpperBound: string = ) to (direction: SortDirection, count: int, exclusiveLowerBound: Variant, exclusiveUpperBound: Variant)
- 600 Change ReturnType of GetAsync from Variant to Tuple
- 573 Change ReturnType of RemoveAsync from void to null
- 487 Change Parameters of UpdateAsync from (key: string, transformFunction: Function, expiration: int64 = -1) to (key: string, transformFunction: Function, expiration: int64)
- 487 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int64 = -1) to (key: string, value: Variant, expiration: int64)
- 477 Change ReturnType of UpdateAsync from void to Variant
- 477 Change Parameters of UpdateAsync from (key: string, transformFunction: Function, expiration: int = -1) to (key: string, transformFunction: Function, expiration: int64 = -1)
- 477 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int = -1) to (key: string, value: Variant, expiration: int64 = -1)
- 475 Add UpdateAsync
- 475 Add SetAsync
- 475 Add RemoveAsync
- 475 Add GetRangeAsync
- 475 Add GetAsync
- 475 Add MemoryStoreSortedMap
Members 5
GetAsync
Parameters (1) | ||
---|---|---|
key | string | |
Returns (1) | ||
Tuple |
Retrieves the value and sort key of a key in the sorted map.
Thread safety | Unsafe |
---|
GetRangeAsync
Parameters (4) | ||
---|---|---|
direction | SortDirection | |
count | int | |
exclusiveLowerBound | Variant | |
exclusiveUpperBound | Variant | |
Returns (1) | ||
Array |
Gets items within a sorted range of keys and sort keys.
Thread safety | Unsafe |
---|
History 2
- 600 Change Parameters of GetRangeAsync from (direction: SortDirection, count: int, exclusiveLowerBound: string = , exclusiveUpperBound: string = ) to (direction: SortDirection, count: int, exclusiveLowerBound: Variant, exclusiveUpperBound: Variant)
- 475 Add GetRangeAsync
RemoveAsync
Parameters (1) | ||
---|---|---|
key | string | |
Returns (1) | ||
null |
Removes the provided key from the sorted map.
Thread safety | Unsafe |
---|
History 2
- 573 Change ReturnType of RemoveAsync from void to null
- 475 Add RemoveAsync
SetAsync
Parameters (4) | ||
---|---|---|
key | string | |
value | Variant | |
expiration | int64 | |
sortKey | Variant | |
Returns (1) | ||
bool |
Sets the value and sort key of the key overwriting any existing key value and sort key.
Thread safety | Unsafe |
---|
History 4
- 600 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int64) to (key: string, value: Variant, expiration: int64, sortKey: Variant)
- 487 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int64 = -1) to (key: string, value: Variant, expiration: int64)
- 477 Change Parameters of SetAsync from (key: string, value: Variant, expiration: int = -1) to (key: string, value: Variant, expiration: int64 = -1)
- 475 Add SetAsync
UpdateAsync
Parameters (3) | ||
---|---|---|
key | string | |
transformFunction | Function | |
expiration | int64 | |
Returns (1) | ||
Tuple |
Retrieves the value and sort key of a key from a sorted map and lets you update it to a new value and sort key via a callback function.
This method accepts a callback function that transforms the old value and old sort key into the updated value and updated sort key as required. The method retrieves the existing key value and sort key and passes it to the transform function which returns the new value and sort key for the item, with these exceptions:
- If the key does not exist, the old value and old sort key passed to the function will be nil.
- If the function returns nil, the update is canceled.
The new value and new sort key is saved only if the key was not updated (e.g. by a different game server) since the moment it was read. If the value or sort key did change, the transform function is invoked again with the most recent item value and sort key. This cycle repeats until the value and sort key are saved successfully or the transform function returns nil to abort the operation.
Thread safety | Unsafe |
---|
History 5
- 600 Change ReturnType of UpdateAsync from Variant to Tuple
- 487 Change Parameters of UpdateAsync from (key: string, transformFunction: Function, expiration: int64 = -1) to (key: string, transformFunction: Function, expiration: int64)
- 477 Change ReturnType of UpdateAsync from void to Variant
- 477 Change Parameters of UpdateAsync from (key: string, transformFunction: Function, expiration: int = -1) to (key: string, transformFunction: Function, expiration: int64 = -1)
- 475 Add UpdateAsync