LRUSet for seenEvents

This commit is contained in:
Martti Malmi
2024-01-03 23:33:35 +02:00
parent 38093fdf3b
commit 7ac5bb6d41
2 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import Dexie, { Table } from "dexie";
import { TaggedNostrEvent, ReqFilter as Filter } from "@snort/system";
import * as Comlink from "comlink";
import LRUSet from "@/Cache/LRUSet";
type Tag = {
id: string;
@ -15,7 +16,7 @@ class IndexedDB extends Dexie {
events!: Table<TaggedNostrEvent>;
tags!: Table<Tag>;
private saveQueue: SaveQueueEntry[] = [];
private seenEvents = new Set<string>(); // LRU set maybe?
private seenEvents = new LRUSet<string>(1000);
private subscribedEventIds = new Set<string>();
private subscribedAuthors = new Set<string>();
private subscribedTags = new Set<string>();