> For the complete documentation index, see [llms.txt](https://docs.coherence.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherence.io/0.7.4/api-reference/cloud-api/key-value-store.md).

# Key-value store

## Coherence.Runtime.KvStore

{% hint style="info" %}
The player needs need to be [logged in](/0.7.4/api-reference/cloud-api/game-account.md) to use the Key-value store.
{% endhint %}

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.

```csharp
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)
}
```

## Example

```csharp
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");
```

## Limitations

**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.
