UNPKG

mastercache

Version:

Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers

147 lines (138 loc) 3.14 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/events/index.ts var events_exports = {}; __export(events_exports, { events: () => events }); module.exports = __toCommonJS(events_exports); // src/events/cache/cache-hit.ts var CacheHit = class { constructor(key, value, store, graced = false) { this.key = key; this.value = value; this.store = store; this.graced = graced; } name = "cache:hit"; toJSON() { return { key: this.key, value: this.value, store: this.store, graced: this.graced }; } }; // src/events/cache/cache-miss.ts var CacheMiss = class { constructor(key, store) { this.key = key; this.store = store; } name = "cache:miss"; toJSON() { return { key: this.key, store: this.store }; } }; // src/events/cache/cache-cleared.ts var CacheCleared = class { constructor(store) { this.store = store; } name = "cache:cleared"; toJSON() { return { store: this.store }; } }; // src/events/cache/cache-deleted.ts var CacheDeleted = class { constructor(key, store) { this.key = key; this.store = store; } name = "cache:deleted"; toJSON() { return { key: this.key, store: this.store }; } }; // src/events/cache/cache-written.ts var CacheWritten = class { constructor(key, value, store) { this.key = key; this.value = value; this.store = store; } name = "cache:written"; toJSON() { return { key: this.key, store: this.store, value: this.value }; } }; // src/events/bus/bus-message-received.ts var BusMessageReceived = class { constructor(message) { this.message = message; } name = "bus:message:received"; toJSON() { return { keys: this.message.keys, type: this.message.type }; } }; // src/events/bus/bus-message-published.ts var BusMessagePublished = class { constructor(message) { this.message = message; } name = "bus:message:published"; toJSON() { return { keys: this.message.keys, type: this.message.type }; } }; // src/events/index.ts var events = { BusMessagePublished, BusMessageReceived, CacheHit, CacheMiss, CacheCleared, CacheDeleted, CacheWritten }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { events }); //# sourceMappingURL=index.cjs.map