Locking
Data Store keys can be locked to a specific game server by calling LockKeyOrStealSafely()
or LockKey()
. Keys can be locked in two modes:
ReadWrite
Blocks reads and writes on all other servers. This is the default.
Write
Blocks writes on all other servers. All servers can read the key at any time.
A key lock will last for 24 hours, or until it is unlocked with the UnlockKey()
function. Normally, only the server that owns the lock can unlock the key. However, other servers can steal a lock by passing the serverId that owns the lock to the LockKey()
or UnlockKey()
functions. This should only be done in cases where you know the lock can be stolen safely (ex. the server that owns the lock is offline). You can retrieve the current owner of a lock, along with additional lock data using GetLockDataForKey()
.
Locking Patterns
For simple lock cases, it is best to use the LockKeyOrStealSafely()
function:
Last updated