KV Store

Global edge key-value store with sub-millisecond reads.

Overview

RaidFrame KV is a globally distributed key-value store optimized for low-latency reads. Data is replicated to edge locations worldwide. Reads resolve in under 1ms from the nearest PoP.

rf add kv
✓ KV Store provisioned
✓ KV_URL injected into environment
✓ KV_TOKEN injected

Use Cases

  • Feature flags — toggle features without redeploying
  • Session storage — distributed sessions across regions
  • Rate limiting — global counters with atomic increments
  • Configuration — runtime config changes without restarts
  • A/B test assignments — consistent user bucketing at the edge

SDK Usage

Node.js

import { KV } from "@raidframe/sdk";

const kv = new KV();

// Set a value
await kv.set("user:u_123:plan", "pro");

// Set with TTL
await kv.set("session:abc", JSON.stringify(sessionData), { ttl: 3600 });

// Get a value
const plan = await kv.get("user:u_123:plan");

// Delete
await kv.delete("session:abc");

// List keys by prefix
const sessions = await kv.list({ prefix: "session:" });

// Atomic increment
const count = await kv.incr("api:rate:192.168.1.1");

Python

from raidframe import KV

kv = KV()
kv.set("feature:dark-mode", "true")
enabled = kv.get("feature:dark-mode")

Consistency Model

KV uses eventual consistency with a propagation time of under 500ms globally. Writes go to the primary region and replicate to all edge locations.

For use cases requiring strong consistency (e.g., counters), use the consistent flag:

// Eventually consistent read (fast, from nearest edge)
const value = await kv.get("key");

// Strongly consistent read (slower, from primary region)
const value = await kv.get("key", { consistent: true });

CLI Commands

# Set a value
rf kv set feature:dark-mode true

# Get a value
rf kv get feature:dark-mode

# List keys
rf kv list --prefix "feature:"

# Delete
rf kv delete feature:dark-mode

# Bulk import from JSON
rf kv import ./flags.json

Configuration

kv:
  flags:
    type: kv
    regions: all          # Replicate to all edge locations
    default_ttl: 0        # No expiry by default
    max_value_size: 100KB

Pricing

PlanReads/moWrites/moStoragePrice
Starter100K10K100 MBFree
Standard10M1M1 GB$10/mo
Pro100M10M10 GB$30/mo