Records
Roaming databases have records stored as key-value pairs with an optional cell for the category. Using key-value pairs enables generic and space-efficient storage of various data types. The optional category cell combines with the key to create a unique key for easier namespace management.
Field | SDK type | DB type | Size limit | Optional |
---|---|---|---|---|
key | string | TEXT | 1 GB | No |
value | byte[] | BLOB | 1 GB | No |
category | string | TEXT | 1 GB | Yes |
Category
A category is an optional field representing a distinct collection of keys. You only need to make keys unique within a specific category, and you can use the category as a filtering mechanism when iterating through records. The category field defaults to an empty string.
Key
A key is the primary identifier of a record. It must be unique within a specific category, even if the category uses the default empty string. The key is required, can have any length, and can't be empty (refer to Limitations).
Value
A value is a byte array (byte[]
) of a record. It can be of any length, up to 1 GB (refer to Limitations). The recommended best practice is to keep the size of values below 100 KB to 1 MB for optimal performance. The exact value depends on the number of transactions per frame.
The database doesn’t keep track of the original data type before serialization to a byte stream. You, as the developer, are responsible for ensuring you deserialize values to the correct type.