Setu-TS
    Preparing search index...

    A cache store backed by Workers KV.

    Two platform properties are worth knowing before choosing this store over a Durable Object or an origin cache:

    • Writes are eventually consistent. A set is not guaranteed visible to a read in another location immediately. KV suits read-heavy, tolerant caching, not coordination.
    • TTLs below 60 seconds are enforced by this store, not by KV. The value carries its own deadline, so a short entry reads as a miss on time even though the key survives up to a minute longer. See kv-envelope.ts.
    const cache = ctx.services.get<ICacheStore>(CAPABILITIES.CACHE);
    await cache.set('user:1', user, 30); // honored at 30s despite KV's 60s floor

    0.2.0

    Implements

    Index
    • Removes every key this store owns.

      KV has no bulk delete on the binding, so this pages list and issues one delete per key — linear in the number of entries, and worth avoiding on a hot path.

      Returns Promise<void>

      When the store has no key prefix

    • Stores a value.

      Type Parameters

      • T

        The value type

      Parameters

      • key: string

        Cache key

      • value: T

        Value to store

      • OptionalttlSeconds: number

        Time-to-live in seconds; omit for the store default

      Returns Promise<void>