> kv
Workers KV is Cloudflare's globally distributed, eventually-consistent key-value store — built for config, feature flags, and edge caching that's read far more than it's written. In wrangler v4 you manage it through three command groups: `kv namespace` to provision stores, `kv key` for single get/put/list/delete, and `kv bulk` for batch put/get/delete. Every command targets the real remote namespace by default; pass `--local` to work against the on-disk store that `wrangler dev` serves.
// kv
10 commands$ wrangler kv namespace create SESSIONS$ wrangler kv namespace create SESSIONS --preview$ wrangler kv namespace list$ wrangler kv key put KEY VALUE --binding=SESSIONS$ wrangler kv key put "cache:home" "$(cat page.html)" --binding=CACHE --ttl 3600$ wrangler kv key get KEY --binding=SESSIONS --text$ wrangler kv key list --binding=SESSIONS --prefix "user:"$ wrangler kv key put KEY VALUE --binding=CACHE --local$ wrangler kv bulk put ./data.json --binding=CACHE$ wrangler kv key put FEATURE_X on --binding=CONFIG --env production// faq
Do wrangler kv commands hit local or remote KV by default?
Remote — the live namespace on Cloudflare's edge. Add `--local` to read/write the on-disk `.wrangler/state` store that `wrangler dev` uses, or `--remote` to be explicit. Local and remote are entirely separate stores.
How do I delete many keys at once (purge a cache)?
Write a JSON array of key names to a file and run `wrangler kv bulk delete ./keys.json --binding=<BINDING>`. Build the key list with `wrangler kv key list --binding=<BINDING> --prefix "..."` piped through jq.
Why doesn't my KV write show up immediately?
KV is eventually consistent. A write is visible right away in the location that made it but can take up to ~60 seconds to propagate to other edge locations. TTLs also enforce a 60-second minimum.