Workers KV (Key-Value Storage)

What is it?

Workers KV is a global, low-latency, key-value data store. It stores data as simple key-value pairs (like a dictionary or hash map) and replicates that data across Cloudflare's entire network. When you read a value, you get it from the nearest data center — making reads extremely fast (under 10ms for hot keys).

What problem does it solve?

Applications often need to store simple configuration data, user sessions, feature flags, or cached results that need to be accessible globally with minimal latency:

  • Global configuration: Store feature flags, API keys, or settings that every edge location needs access to.
  • Session storage: Store user session data close to where users are.
  • Caching: Cache API responses or computed results.
  • Edge data: Store data that Workers need to make decisions without calling an origin server.

How does it work?

KV follows an eventually consistent model:

  1. Writes go to a central store and are then propagated to all edge locations worldwide (this takes up to 60 seconds).
  2. Reads are served from the nearest edge location, so they're extremely fast once the data has propagated.
  3. Data is stored as key → value pairs, where values can be up to 25 MB and can include metadata.
  4. A Worker accesses KV through a binding — a named reference to a KV namespace.

Key characteristics:

  • Read-heavy: Optimized for workloads with many more reads than writes. Not suitable for data that changes frequently (use Durable Objects for that).
  • Eventually consistent: After a write, it may take up to 60 seconds for all edge locations to see the new value.
  • Simple API: put(key, value), get(key), delete(key), list().
  • TTL support: Values can automatically expire after a set time.

When to use KV vs. other storage:

  • KV: High-read, low-write data that doesn't need instant consistency (config, cached data, sessions).
  • D1: Relational data that needs SQL queries.
  • R2: Large files and blobs.
  • Durable Objects: Data that needs strong consistency and real-time coordination.

Why it matters strategically

KV was one of the first storage primitives on Cloudflare's developer platform. It's important because it demonstrated that Cloudflare could go beyond compute (Workers) and offer storage — a critical step toward becoming a full cloud platform. KV's global distribution model is also a differentiator that traditional cloud providers struggle to match.

Learn more