Skip to main content

DataStorage

ZEPETO.Multiplay.DataStorage.DataStorage

Represents a data storage abstraction providing methods to store, retrieve, and remove data. This interface defines asynchronous operations for single and multiple data manipulations.

Methods

get

get<T>(key): Promise<T>

Retrieves a value by its key. Throws DataStorageError.

Type parameters

NameDescription
TOptionally specifies the type of the retrieved value.

Parameters

NameTypeDescription
keystringThe key to search for.

Returns

Promise<T>

Promise resolved upon completion with a value of type T.


mget

mget<T>(keys): Promise<{ [key: string]: T; }>

Retrieves values by multiple keys. Throws DataStorageError.

Type parameters

NameDescription
TOptionally specifies the type of retrieved values.

Parameters

NameTypeDescription
keysstring[]Array of keys to search for.

Returns

Promise<{ [key: string]: T; }>

Promise resolved upon completion with a key-value object.


mset

mset<T>(keyValueSet): Promise<boolean>

Stores multiple values with specified keys. Throws DataStorageError.

Type parameters

NameDescription
TOptionally specifies the type of data to store.

Parameters

NameTypeDescription
keyValueSet{ }[]Array of key-value objects to store.

Returns

Promise<boolean>

Promise resolved upon completion, indicating success (true) or failure (false).


remove

remove(key): Promise<boolean>

Removes a value with a specified key. Throws DataStorageError.

Parameters

NameTypeDescription
keystringThe key to search for.

Returns

Promise<boolean>

Promise resolved upon completion, indicating success (true) or failure (false).


set

set<T>(key, value): Promise<boolean>

Stores a value with a specified key. Throws DataStorageError.

Type parameters

NameDescription
TOptionally specifies the type of the data to store.

Parameters

NameTypeDescription
keystringThe key for storage.
valueTData to store.

Returns

Promise<boolean>

Promise resolved upon completion, indicating success (true) or failure (false).