Skip to content
Docs

Key-Value Store

The Key-Value Store (KV) is the simplest piece of storage in Publicus: a flat map of names to free-form values, scoped to the tenant. Every activity in every flow can read every key, which makes it the natural home for cursors, counters, feature flags, and anything else that needs to outlive a single run.

The Key-value list: each key with its JSON value, and Read this value in a flow, Inspect and Edit on every row
The Key-value list: each key with its JSON value, and Read this value in a flow, Inspect and Edit on every row

Go to Key-value.

  1. New key-value entry — create a new entry.

  2. Fill in:

    • Key — how you will reference it, e.g. last_sync_time.
    • Value — any string or JSON payload.
    The Create key-value entry form with Key and Value fields and Create, Create & create another and Cancel
    The Create key-value entry form with Key and Value fields and Create, Create & create another and Cancel
  3. Save. The entry is available to flows immediately.

From the same screen you can edit, delete, and tag entries. Each key holds one entry: saving a new entry, or renaming one, under a key that is already taken is refused. A workspace created before that rule can still hold two entries under one key, and $kv then reads either of them; a write or a delete by key reaches them all, so delete the spare one.

The list shows a preview of each entry’s value, pretty-printed and truncated to roughly 120 characters; hover over it to see the full value in a tooltip. The value column is searchable by content, so you can find an entry by what is stored in it, not only by its key.

Each entry also has an Inspect action that opens a read-only view of the stored JSON, pretty-printed with a copy button. Use it to check what a flow wrote without opening the edit form.

The read-only view of a key-value entry: its key, when it was created, and its value as pretty-printed JSON, with Edit
The read-only view of a key-value entry: its key, when it was created, and its value as pretty-printed JSON, with Edit

Two ways:

  • Implicitly, in any expression field: a Transformer template, a Rest/Operation URL, an Injector body, and so on. Write {{ $workflow->kv('last_sync_time') }}. It works for every key, including one with a dot, a dash or a colon in it, such as {{ $workflow->kv('acme.last-sync') }}, and the run fetches only the keys named this way. The shorter {{ $kv->last_sync_time }} reads the same entry, but only for a key made of letters, digits and underscores, and it loads every entry in the workspace to do it.
  • Explicitly, via the KeyValueStore / Get node. You pick the entry; the node emits the stored value as its output, and the next node reads it as $prev.

Use the Key-Value Set node. Instructions:

  • Entry — pick the entry, or leave it empty and give a Key instead. By key, the entry is created when the workspace has none, so a flow can keep one entry per customer (cursor:{{ $prev->customerId }}) without anyone making them first.
  • Value — the new value. The field is expression-capable, so you can snapshot part of the upstream output on each run, e.g. {!! $prev->meta->nextCursor !!}. Use the raw {!! !!} echo here: a later run reads the stored value back, so it must not be HTML-escaped.

The Set node overwrites the current value; it does not merge.

  • Key-Value Delete removes an entry, by the entry or by its key.
  • Key-Value List lists the entries whose key starts with a prefix, such as every cursor: entry, for the next node to work through.

When Key-Value Entries Change starts a flow when an entry is added, edited or deleted, for every key or only the keys under a prefix such as rates-. The run gets the key and the entry’s value. The Triggers button on the Key-value screen shows which flows start on a change and what the latest changes started.

The key-value Triggers panel: Apply new partner rate limits, live, starts when entries with keys starting acme.partner-rate-limits are added or edited, a second flow is switched off, and the latest change, an edit by Docs Writer, started the live one
The key-value Triggers panel: Apply new partner rate limits, live, starts when entries with keys starting acme.partner-rate-limits are added or edited, a second flow is switched off, and the latest change, an edit by Docs Writer, started the live one
  • Cursors for paginated APIs when the cursor needs to survive between scheduled runs.
  • Last-success timestamps for incremental syncs.
  • Feature flags toggled outside of code to turn branches of a flow on or off.
  • Counters that accumulate across runs, written with Set using a {{ $kv->counter + 1 }} expression.

Anything that needs structure — more than one field per record, or the ability to filter — belongs in the Table Store instead.