mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
25 lines (21 loc) • 459 B
text/typescript
import type { CacheEvent } from '../../types/main';
/**
* Event emitted when a cache entry is hit
*/
export class CacheHit implements CacheEvent {
name = 'cache:hit' as const;
constructor(
readonly key: string,
readonly value: any,
readonly store: string,
readonly graced: boolean = false,
) {}
toJSON() {
return {
key: this.key,
value: this.value,
store: this.store,
graced: this.graced,
};
}
}