mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
121 lines (114 loc) • 2.12 kB
JavaScript
// 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
};
export {
events
};
//# sourceMappingURL=index.js.map