Zebflow Docs
kv.entry.increment
Zebflow Docs

kv.entry.increment

Counts an integer counter in the project's key-value store up or down

kv.entry.increment --key TEXT [--amount N] [--durable] → entry

Counts an integer counter in the project's key-value store up or down. Add --amount (a whole number, default 1, negative to count down) to the integer counter --key in the project's key-value store (--durable for the disk-backed one); a missing key starts at 0. Adds entry: { key, value } — the new count — and keeps the rest of the payload.

Flags

  • --key (required): The counter. Usually a {{ }} expression.
  • --amount: What to add: a whole number, default 1, negative to count down.
  • --durable: Use the disk-backed store, which survives a restart. Default: the in-memory one.

Examples

Count clicks per button

| kv.entry.increment --key "clicks:{{ $trigger.body.button }}"

The new count is input.entry.value.

It answers:

json
{  "entry": {    "key": "clicks:buy",    "value": 42  }}