If you use `ndk` there are different store options:

LRU -> https://nostr-dev-kit.github.io/ndk/cache/memory.html

SQLite/WASM -> https://nostr-dev-kit.github.io/ndk/cache/sqlite-wasm/INDEX.html]

Local Relay -> https://nostr-dev-kit.github.io/ndk/cache/nostr.html

Reply to this note

Please Login to reply.

Discussion

Thanks for it!

I am developing a library (https://www.npmjs.com/package/nostr-tribes) with the least amount of dependencies. It already depends on nostr-tools (this is its only dependency), and it is not the right time to add a new 8.7megs dependency to ndk (memory cache adapter depends on ndk main package).

In my mind this module should be more like a package that others depend on, instead of a package that depends on code that supports cashu, nutzaps, nip5 and so on.

Like your asknostr.site though! Great initiative, might answer my 2nd question :)

💡 Turns out it's quite simple to write. Not very performant, but will do for now.

import { matchFilter, type Event, type Filter } from "nostr-tools"

export class MemStore {

events: Event[]

constructor() {

this.events = []

}

add(event: Event) {

this.events.push(event)

}

req(filtr: Filter): Event[] {

let r: Event[] = []

this.events.forEach(e => {

if (matchFilter(filtr, e)) {

r.push(e)

}

})

return r

}

}