Key-value store
The key-value store provides a simple persistence layer for the players.
This class provides the methods to set, get and unset key-value pairs. This is executed within the context of the currently logged in player.
public static class KvStore
{
// Sets a value
// key: lowercase letters, numbers, underscore, dash
// val: any string (null is not allowed)
public static void Set(string key, string val)
// Gets a value
// key: lowercase letters, numbers, underscore, dash
public static string Get(string key)
// Unsets a value, removing it from the store
// key: lowercase letters, numbers, underscore, dash
public static void Unset(string key)
}
Coherence.Runtime.KvStore.Set("foo", "1");
var foo = Coherence.Runtime.KvStore.Get("foo");
Debug.Log(string.Format("foo={0}", foo)); // foo=1
Coherence.Runtime.KvStore.Unset("foo");
Size: there are no limits to the number of stored key/values as long as the total size is less than 256 kB.
Requests: Set/Get/Unset can be called unlimited amount of times but the execution may be throttled.
Last modified 7mo ago