@earth-app/collegedb
    Preparing search index...

    Interface KVStorage

    Provider-agnostic key-value storage contract.

    This interface is implemented by Cloudflare KV, Redis/Valkey adapters, and any custom KV backend supported by CollegeDB.

    interface KVStorage {
        delete(key: string): Promise<void>;
        get<T = unknown>(key: string, type: "json"): Promise<T | null>;
        get(key: string, type?: "text"): Promise<string | null>;
        list(
            options?: { cursor?: string; limit?: number; prefix?: string },
        ): Promise<KVListResult>;
        put(key: string, value: string): Promise<void>;
    }
    Index

    Methods

    Methods

    • Deletes a key.

      Parameters

      • key: string

      Returns Promise<void>

    • Retrieves a value by key. When type is json, the value should be parsed.

      Type Parameters

      • T = unknown

      Parameters

      • key: string
      • type: "json"

      Returns Promise<T | null>

    • Parameters

      • key: string
      • Optionaltype: "text"

      Returns Promise<string | null>

    • Lists keys, optionally filtered by prefix.

      Parameters

      • Optionaloptions: { cursor?: string; limit?: number; prefix?: string }

      Returns Promise<KVListResult>

    • Stores a value by key.

      Parameters

      • key: string
      • value: string

      Returns Promise<void>