// src/modules/driver-memory/LruCacheMap.ts
import { LRUCache } from "lru-cache";
var LruCacheMap = class {
  lruCache;
  constructor(options) {
    this.lruCache = new LRUCache(options ?? { max: 5e3 });
  }
  clear() {
    this.lruCache.clear();
  }
  delete(id) {
    return this.lruCache.delete(id);
  }
  get(id) {
    return this.lruCache.get(id);
  }
  getMany(id) {
    const results = [];
    for (const key of id) {
      const value = this.lruCache.get(key);
      if (value !== void 0) {
        results.push(value);
      }
    }
    return results;
  }
  has(id) {
    return this.lruCache.has(id);
  }
  set(id, data) {
    this.lruCache.set(id, data);
  }
  setMany(entries) {
    for (const [key, value] of entries) {
      this.lruCache.set(key, value);
    }
  }
};

// src/modules/driver-memory/MemoryMap.ts
import { isDefined } from "@ariestools/sdk";
var MemoryMap = class {
  map;
  constructor() {
    this.map = /* @__PURE__ */ new Map();
  }
  clear() {
    this.map.clear();
  }
  delete(id) {
    return this.map.delete(id);
  }
  get(id) {
    return this.map.get(id);
  }
  getMany(ids) {
    const results = [];
    for (const id of ids) {
      const data = this.map.get(id);
      if (isDefined(data)) {
        results.push(data);
      }
    }
    return results;
  }
  has(id) {
    return this.map.has(id);
  }
  set(id, data) {
    this.map.set(id, data);
  }
  setMany(entries) {
    for (const [key, value] of entries) {
      this.map.set(key, value);
    }
  }
};
export {
  LruCacheMap,
  MemoryMap
};
//# sourceMappingURL=driver-memory.mjs.map
