UNPKG

@httpc/kit

Version:

httpc toolbox for building function-based API with minimal code and end-to-end type safety

36 lines (35 loc) 922 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LruCache = void 0; const lru_cache_1 = __importDefault(require("lru-cache")); class LruCache { constructor(options) { const { size = 100, ttl = 0 } = options; this.provider = new lru_cache_1.default({ max: size, ttl, }); } keys() { return this.provider.keys(); } has(key) { return this.provider.has(key); } get(key) { return this.provider.get(key); } set(key, value) { this.provider.set(key, value); } delete(key) { this.provider.delete(key); } clear() { this.provider.clear(); } } exports.LruCache = LruCache;