Method StoreObjectAsync
- Namespace
- WhalesSecret.TradeScriptLib.API
- Assembly
- WhalesSecret.TradeScriptLib.dll
StoreObjectAsync<TValue>(byte[], TValue)
Stores a serialized value of an object to the persistent script storage under the given key.
Task StoreObjectAsync<TValue>(byte[] key, TValue value)
Parameters
key
byte[]Key under which the object is stored. Maximum length of the key is StorageMaxKeyLength bytes.
value
TValueValue to store under the given key.
Returns
Type Parameters
TValue
Type of the object to store.
Exceptions
- InvalidArgumentException
Thrown if the
key
is too long, empty ornull
.- StorageQuotaReachedException
Thrown if the value cannot be stored because the script's storage quota has been reached.
- SerializationException
Thrown if the object cannot be serialized to the byte array.
- DatabaseErrorException
Thrown if a database error occurred.
StoreObjectAsync<TValue>(string, TValue)
Stores a serialized value of an object to the persistent script storage under the given key.
Task StoreObjectAsync<TValue>(string key, TValue value)
Parameters
key
stringKey under which the object is stored. They key is interpreted as UTF-8 string and converted to a binary representation. Maximum length of the key after the conversion is StorageMaxKeyLength bytes. The key must not be empty.
value
TValueValue to store under the given key.
Returns
Type Parameters
TValue
Type of the object to store.
Exceptions
- InvalidArgumentException
Thrown if the
key
is too long, empty ornull
.- StorageQuotaReachedException
Thrown if the value cannot be stored because the script's storage quota has been reached.
- SerializationException
Thrown if the object cannot be serialized to the byte array.
- DatabaseErrorException
Thrown if a database error occurred.