Crate worker_kv

source ·
Expand description

Bindings to Cloudflare Worker’s KV to be used inside of a worker’s context.

§Example

let kv = KvStore::create("Example")?;

// Insert a new entry into the kv.
kv.put("example_key", "example_value")?
    .metadata(vec![1, 2, 3, 4]) // Use some arbitrary serialiazable metadata
    .execute()
    .await?;

// NOTE: kv changes can take a minute to become visible to other workers.
// Get that same metadata.
let (value, metadata) = kv.get("example_key").text_with_metadata::<Vec<usize>>().await?;

Structs§

Enums§

  • A simple error type that can occur during kv operations.

Traits§