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
Name | Description |
---|---|
T | Optionally specifies the type of the retrieved value. |
Parameters
Name | Type | Description |
---|---|---|
key | string | The 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
Name | Description |
---|---|
T | Optionally specifies the type of retrieved values. |
Parameters
Name | Type | Description |
---|---|---|
keys | string [] | 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
Name | Description |
---|---|
T | Optionally specifies the type of data to store. |
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
key | string | The 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
Name | Description |
---|---|
T | Optionally specifies the type of the data to store. |
Parameters
Name | Type | Description |
---|---|---|
key | string | The key for storage. |
value | T | Data to store. |
Returns
Promise
<boolean
>
Promise
resolved upon completion, indicating success (true
) or failure (false
).