Private
CheckDeletes the data associated with the given key.
The key to use. Keys must be alphanumeric and may include the following symbols: _-.:
The data that was deleted. If no data was deleted, nothing will be returned.
Works similarly to GetAndSet, but allows you to delete a key based on the key's data. If the callback returns true, the key will be deleted only if it has not changed. If the callback returns false, this function will return the current data value of the key. If the key is already unset, the function will return success with no data.
The callback function will not be called if the key has no associated data.
The key to use. Keys must be alphanumeric and may include the following symbols: _-.:
The function that will be called to determine if the value should be deleted. Returning true will delete the key.
The data that was deleted. If no data was deleted, nothing will be returned.
Allows you to update data for a key only if the data has not been changed since it was retrieved. This is good for keys which may be modified across different servers and you want to make sure that you are always operating on the most up to date data. This function is also useful when multiple servers may attempt to set the initial data for a key. It will ensure that only one set operation succeeds in writing the intial data.
This function works by first retrieving the data associated with a key, then passing that data to the provided callback. The return value of the provided callback will be used as the new data for the key. If a change has been made to the data associated with the key between the get operation and the set operation, this function will fail with a conflict error.
If no data is associated with the key initially, the callback will be provided no data, and the return value will be associated with the provided key. If data was associated with the key between the get operation and the set operation, this function will fail with a conflict error.
Returning no data from the callback (undefined) will abort the update and no data will be changed.
The data that was associated with the provided key.
Gets the data associated with the given key.
The key to use. Keys must be alphanumeric and may include the following symbols: _-.:
The data associated with the provided key. If no data is found, nothing is returned.
Locks a data store key so that only the server that locked the key can write to it. The lock mode can be specified to allow reads from other servers on locked keys. Locks time out after 24 hours.
This function does not perform any additional actions in attempt to aquire the lock.
The key to lock.
The mode to lock the key with. Defaults to ReadWrite which disables both reading and writing on all other servers.
Optional
stealFromOwnerId: stringSteals the lock from this ownerId if the key is already locked.
True if the key was successfully locked to this server. False otherwise.
Locks a data store key so that only the server that locked the key can write to it. The lock mode can be specified to allow reads from other servers on locked keys. Locks time out after 24 hours.
This function performs additional checks and attempts to steal the lock if it can be stolen safely.
A lock can be stolen safely if the server that owns the lock is offline.
The key to lock.
The mode to lock the key with. Defaults to ReadWrite which disables both reading and writing on all other servers.
True if the key was successfully locked to this server. False otherwise.
Sets the data for the given key.
The key to use. Keys must be alphanumeric and may include the following symbols: _-.:
The data to associate with the provided key.
The data that was associated with the provided key.
Unlocks a data store key so that all servers can read and write the key. If the current game server does not own the lock, this operation will fail, unless you steal the lock by providing the current ownerId of the lock.
The key you wish to unlock.
Optional
stealFromOwnerId: stringThe ownerId of the current lock holder. Only provide this parameter if you want to steal the lock.
True if the key was successfully unlocked. False otherwise.
The Data Store provides simple key/value persistent storage.
The data store provides durable storage that can be accessed from any game server. Data access is slower than the Cache Store, but the data will never expire.
The Data Store is good for things like user profiles or unlocks. If you want to keep track of user statistics or build tradable inventory, check out the Leaderboard and PlatformInventory systems.