MemoryStoreHashMap
Provides access to a hash map within MemoryStoreService.
Memory category | Instances |
---|
Member index 5
Description
Provides access to a hash map within MemoryStoreService. A hash map is a collection of items where string keys are associated with arbitrary values (up to the maximum allowed size -- see Memory Stores). The keys have no ordering guarantees.
History 6
- 605 Add ListItemsAsync
- 591 Add UpdateAsync
- 591 Add SetAsync
- 591 Add RemoveAsync
- 591 Add GetAsync
- 591 Add MemoryStoreHashMap
Members 5
GetAsync
Parameters (1) | ||
---|---|---|
key | string | |
Returns (1) | ||
Variant |
Retrieves the value of a key in the hash map.
Thread safety | Unsafe |
---|
ListItemsAsync
Parameters (1) | ||
---|---|---|
count | int | |
Returns (1) | ||
MemoryStoreHashMapPages |
Returns a MemoryStoreHashMapPages object for enumerating through items in the hash map. The valid range is 1 to 200 inclusive.
Thread safety | Unsafe |
---|
History 1
- 605 Add ListItemsAsync
RemoveAsync
Parameters (1) | ||
---|---|---|
key | string | |
Returns (1) | ||
null |
Removes an item from the hash map.
Thread safety | Unsafe |
---|
History 1
- 591 Add RemoveAsync
SetAsync
Parameters (3) | ||
---|---|---|
key | string | |
value | Variant | |
expiration | int64 | |
Returns (1) | ||
bool |
Sets the value of a key in the hash map, overwriting any existing value.
Thread safety | Unsafe |
---|
UpdateAsync
Parameters (3) | ||
---|---|---|
key | string | |
transformFunction | Function | |
expiration | int64 | |
Returns (1) | ||
Variant |
Retrieves the value of a key from a hash map and lets you update it to a new value.
This method accepts a callback function that retrieves the existing key value and passes it to a transform function, which returns the new value for the item, with these exceptions:
- If the key does not exist, the old value passed to the function is nil.
- If the function returns nil, the update is canceled.
The new value is saved only if the key was not updated (for example, by a different game server) since the moment it was read. If the value changed in that time, the transform function is called again with the most recent item value. This cycle repeats until the value is saved successfully or the transform function returns nil to abort the operation.
Thread safety | Unsafe |
---|
History 1
- 591 Add UpdateAsync