I had Chad build me an in-memory Nostr event cache. https://chat.openai.com/share/bdd53433-d5e2-44ec-ae1f-0eda8a70aa5d
Discussion
Now just pop a TTL/LRU cache on top of this instead of a Map, and everything is wonderful.
The memory cost of thread-safe "linked list" indexes surpasses the cost of events in memory. Keep that in mind. The bigger the number of indexes (and thus the efficiency of retrieve/search), the lesser the number of events you can keep in memory.
Sometimes you're better than me as developer 🤔🤌
Ugh TypeScript is so ugly. Great prompting, though! It's wonderful what ChatGPT can do when you're very specific about what you want from it!