> 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.5.2/api-reference/cloud-api/key-value-store.md).

# Key-value store

## Coherence.Play.DB

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
Play.KvStore.Set("foo", "1");

var foo = Play.KvStore.Get("foo");
Debug.Log(string.Format("foo={0}", foo)); // foo=1

Play.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 256kb.

**Requests**: Set/Get/Unset can be called unlimited amount of times but the execution may be throttled.
