Skip to main content

set

Sets a value in the store.

Syntax

store.set(key, value, ttl);

Parameters

NameTypeDescription
keystringThe key of the value to set.
valueanyThe value to set.
ttlnumberThe time to live in seconds. (Default: 3600 * 24)

Returns

  • Promise<void> - A promise that resolves when the value is set.

Example

// Set a value in the store that expires in 60 seconds.
await store.set('player1', 100, 60);

Available on: Client Server