From 36bef2420c5b8093a9d4400458e0913c3c5a69a4 Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Mon, 4 Mar 2024 11:16:33 +0100 Subject: [PATCH] Document and --- docs/services/sdk/state.mdx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/services/sdk/state.mdx b/docs/services/sdk/state.mdx index bf8d44b0..b758d84a 100644 --- a/docs/services/sdk/state.mdx +++ b/docs/services/sdk/state.mdx @@ -10,6 +10,13 @@ import TabItem from '@theme/TabItem'; Restate offers durable storage of application state, with support for key-value state that can be retrieved, set, and cleared via its key. Using this feature requires no additional setup. +## Listing state keys +To list all the keys that have entries in the state store for that invocation (and its keyed service instance),, do: + +``` +ctx.stateKeys(); +``` + ## Retrieving state To retrieve state in Restate, you can do the following: @@ -126,3 +133,9 @@ Have a look at [the docs on retrieving state](/services/sdk/state#retrieving-sta + +To delete all K/V state entries for the invocation (and its keyed service instance), do: + +``` +ctx.clearAll(); +```