INNER CODE UNIT · TypeScript

KVCache

cloudflare/workers-graphql-server · src/kv-cache.ts:5

class KVCache {
  #binding: KVNamespace

  constructor(binding: KVNamespace) {
    this.#binding = binding
  }

  async get(key: string): Promise<any> {
    return this.#binding.get(key)
  }

  async set(key: any, value: any | null, options: SetOptions = {}) {
    if (value === null) {
      return this.#binding.delete(key)
    }

    const opts: KVNamespacePutOptions = {}
    const ttl = options && options.ttl

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…