// src/modules/driver-memory/LruCacheMap.ts
import { LRUCache } from "lru-cache";
var LruCacheMap = class {
  lruCache;
  /** Creates an instance with the supplied configuration. */
  constructor(options) {
    this.lruCache = new LRUCache(options ?? { max: 5e3 });
  }
  /** Removes data through the clear operation. */
  clear() {
    this.lruCache.clear();
  }
  /** Removes data through the delete operation. */
  delete(id) {
    return this.lruCache.delete(id);
  }
  /** Returns get. */
  get(id) {
    return this.lruCache.get(id);
  }
  /** Returns many. */
  getMany(id) {
    const results = [];
    for (const key of id) {
      const value = this.lruCache.get(key);
      if (value !== void 0) {
        results.push(value);
      }
    }
    return results;
  }
  /** Returns the has result exposed by this provider. */
  has(id) {
    return this.lruCache.has(id);
  }
  /** Updates set. */
  set(id, data) {
    this.lruCache.set(id, data);
  }
  /** Updates many. */
  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;
  /** Creates an instance with the supplied configuration. */
  constructor() {
    this.map = /* @__PURE__ */ new Map();
  }
  /** Removes data through the clear operation. */
  clear() {
    this.map.clear();
  }
  /** Removes data through the delete operation. */
  delete(id) {
    return this.map.delete(id);
  }
  /** Returns get. */
  get(id) {
    return this.map.get(id);
  }
  /** Returns many. */
  getMany(ids) {
    const results = [];
    for (const id of ids) {
      const data = this.map.get(id);
      if (isDefined(data)) {
        results.push(data);
      }
    }
    return results;
  }
  /** Returns the has result exposed by this provider. */
  has(id) {
    return this.map.has(id);
  }
  /** Updates set. */
  set(id, data) {
    this.map.set(id, data);
  }
  /** Updates many. */
  setMany(entries) {
    for (const [key, value] of entries) {
      this.map.set(key, value);
    }
  }
};
export {
  LruCacheMap,
  MemoryMap
};
//# sourceMappingURL=driver-memory.mjs.map
