{"version":3,"file":"base.cjs","names":["JsonPlusSerializer"],"sources":["../../src/cache/base.ts"],"sourcesContent":["import { SerializerProtocol } from \"../serde/base.js\";\nimport { JsonPlusSerializer } from \"../serde/jsonplus.js\";\n\nexport type CacheNamespace = string[];\nexport type CacheFullKey = [namespace: CacheNamespace, key: string];\n\nexport abstract class BaseCache<V = unknown> {\n  serde: SerializerProtocol = new JsonPlusSerializer();\n\n  /**\n   * Initialize the cache with a serializer.\n   *\n   * @param serde - The serializer to use.\n   */\n  constructor(serde?: SerializerProtocol) {\n    this.serde = serde || this.serde;\n  }\n\n  /**\n   * Get the cached values for the given keys.\n   *\n   * @param keys - The keys to get.\n   */\n  abstract get(\n    keys: CacheFullKey[]\n  ): Promise<{ key: CacheFullKey; value: V }[]>;\n\n  /**\n   * Set the cached values for the given keys and TTLs.\n   *\n   * @param pairs - The pairs to set.\n   */\n  abstract set(\n    pairs: { key: CacheFullKey; value: V; ttl?: number }[]\n  ): Promise<void>;\n\n  /**\n   * Delete the cached values for the given namespaces.\n   * If no namespaces are provided, clear all cached values.\n   *\n   * @param namespaces - The namespaces to clear.\n   */\n  abstract clear(namespaces: CacheNamespace[]): Promise<void>;\n}\n"],"mappings":";;AAMA,IAAsB,YAAtB,MAA6C;CAC3C,QAA4B,IAAIA,iBAAAA,oBAAoB;;;;;;CAOpD,YAAY,OAA4B;AACtC,OAAK,QAAQ,SAAS,KAAK"}