Skip to content

Class · inherits Instance

MemoryStoreHashMap

Official docs ↗

Provides access to a hash map within MemoryStoreService.

About MemoryStoreHashMap

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.

Methods 5

  • GetAsync(key: string) → VariantYieldsRetrieves the value of a key in the hash map.
  • ListItemsAsync(count: int) → MemoryStoreHashMapPagesYieldsReturns a MemoryStoreHashMapPages object for enumerating through items in the hash map.

    Returns a MemoryStoreHashMapPages object for enumerating through items in the hash map. The valid range is 1 to 200 inclusive.

  • RemoveAsync(key: string) → ()YieldsRemoves an item from the hash map.
  • SetAsync(key: string, value: Variant, expiration: int64) → booleanYieldsSets the value of a key in the hash map.

    Sets the value of a key in the hash map, overwriting any existing value.

  • UpdateAsync(key: string, transformFunction: Function, expiration: int64) → VariantYieldsRetrieves the value of a key from a hash map and lets you update it to a new value.

    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.

MemoryStoreHashMap 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.