[Data Processing](../groups/Data Processing.Data Processing.md) / DataStorage
DataStorage Class
data storage
Table of contents
Methods
asyncGetData(key : string ): Promise <DataStorageResult > other |
---|
Get customize data asynchronously |
asyncGetLocalData(key : string ): Promise <DataStorageResult > other |
Retrieve local data |
asyncGetOtherGameData(gameId : string , key : string ): Promise <DataStorageResult > other |
Asynchronous acquisition of data saved by other games |
asyncRemoveData(key : string ): Promise <DataStorageResultCode > other |
Asynchronous deletion of customize data |
asyncRemoveLocalData(key : string ): Promise <DataStorageResultCode > other |
Delete local data |
asyncSetData(key : string , value : any ): Promise <DataStorageResultCode > other |
Asynchronous setting of customize data |
asyncSetLocalData(key : string , value : any ): Promise <DataStorageResultCode > other |
Set local data |
asyncSetOtherGameData(gameId : string , key : string , value : any ): Promise <DataStorageResultCode > other |
Asynchronous setting of data saved by other games |
getDataSize(data : any ): number other |
Return the current size of the data. The unit is byte. |
Methods
asyncGetData
• Static
asyncGetData(key
): Promise
<DataStorageResult
> other
Get customize data asynchronously
Parameters
key string | Usage: string type key, which is used to find the data that uniquely identifies the storage range: the length of string depends on the setting of asyncSetData. |
---|
Returns
Promise <DataStorageResult > | Previously saved custom data |
---|
asyncGetLocalData
• Static
asyncGetLocalData(key
): Promise
<DataStorageResult
> other
Retrieve local data
Parameters
key string | Usage: key of string type, used to uniquely identify the stored data< Range: There is no limit on the length of the string, but please set an appropriate identifier. |
---|
Returns
Promise <DataStorageResult > | Data acquisition results |
---|
asyncGetOtherGameData
• Static
asyncGetOtherGameData(gameId
, key
): Promise
<DataStorageResult
> other
Asynchronous acquisition of data saved by other games
Parameters
gameId string | Usage: GameId of other games in the developer's backend< Range: The length of the string depends on the length of the gameId. |
---|---|
key string | Usage: A string type key used to search for data stored with a unique identifier< Br>range: The string length depends on the set length. |
Returns
Promise <DataStorageResult > | Data saved by other games |
---|
asyncRemoveData
• Static
asyncRemoveData(key
): Promise
<DataStorageResultCode
> other
Asynchronous deletion of customize data
Parameters
key string | Usage: string type key, which is used to find the data that uniquely identifies the storage range: the length of string depends on the setting of asyncSetData. |
---|
Returns
Promise <DataStorageResultCode > | Data deletion status |
---|
asyncRemoveLocalData
• Static
asyncRemoveLocalData(key
): Promise
<DataStorageResultCode
> other
Delete local data
Parameters
key string | Usage: key of string type, used to uniquely identify the stored data< Range: There is no limit on the length of the string, but please set an appropriate identifier. |
---|
Returns
Promise <DataStorageResultCode > | Data deletion status |
---|
asyncSetData
• Static
asyncSetData(key
, value
): Promise
<DataStorageResultCode
> other
Asynchronous setting of customize data
Parameters
key string | Usage: key of string type, used to uniquely identify the stored data< Range: There is no limit on the length of the string, but please set an appropriate identifier. |
---|---|
value any | Usage: The data to be saved does not support the map type and the data structure contains a map, and the function cannot be restored |
Returns
Promise <DataStorageResultCode > | Data storage status |
---|
asyncSetLocalData
• Static
asyncSetLocalData(key
, value
): Promise
<DataStorageResultCode
> other
Set local data
Parameters
key string | Usage: key of string type, used to uniquely identify the stored data< Range: There is no limit on the length of the string, but please set an appropriate identifier. |
---|---|
value any | Usage: The data to be saved does not support the map type and the data structure contains a map, and the function cannot be restored |
Returns
Promise <DataStorageResultCode > | Data storage status |
---|
Precautions
Each piece of data can store up to 64kb of encoded data, and the total size of locally stored data cannot exceed 5mb. Data exceeding this limit cannot be stored.
asyncSetOtherGameData
• Static
asyncSetOtherGameData(gameId
, key
, value
): Promise
<DataStorageResultCode
> other
Asynchronous setting of data saved by other games
Parameters
gameId string | Usage: gameId of other games in the developer's background range: The length of the string depends on the length of the gameId. |
---|---|
key string | Usage: String type key used to search for data stored with a unique identifier range: The length of the string depends on the set length. |
value any | Usage: The data to be saved does not support the map type and the data structure contains a map, and the function cannot be restored |
Returns
Promise <DataStorageResultCode > | Set data status codes for other games |
---|
getDataSize
• Static
getDataSize(data
): number
other
Return the current size of the data. The unit is byte.
Parameters
data any | Data key value pairs for objects. |
---|
Returns
number | data size |
---|