/**
 * A cache to store the serialized version of an object
 *
 * This is a thin wrapper around WeakMap
 */
export class SerializedCache {
    map = new WeakMap();
    get(obj) {
        return this.map.get(obj);
    }
    set(obj, serialized) {
        this.map.set(obj, serialized);
    }
    /**
     * Delete cached serialized entries for the provided object references.
     * Must only be called after all DB writes that read from this cache for these objects have completed,
     * otherwise cached serialized bytes will be unavailable and data will be re-serialized unnecessarily.
     */
    delete(objs) {
        for (const obj of objs) {
            this.map.delete(obj);
        }
    }
}
//# sourceMappingURL=serializedCache.js.map