sdk: a bunch of more list loaders.

This commit is contained in:
fiatjaf
2026-04-07 17:39:21 -03:00
parent d5b54a1c91
commit 82f2fbdb99
5 changed files with 175 additions and 52 deletions
+22
View File
@@ -46,6 +46,28 @@ func (sys *System) FetchSearchRelayList(ctx context.Context, pubkey nostr.PubKey
return ml
}
func (sys *System) FetchDMRelayList(ctx context.Context, pubkey nostr.PubKey) GenericList[string, RelayURL] {
sys.dmRelayListCacheOnce.Do(func() {
if sys.DMRelayListCache == nil {
sys.DMRelayListCache = cache_memory.New[GenericList[string, RelayURL]](1000)
}
})
ml, _ := fetchGenericList(sys, ctx, pubkey, 10050, kind_10050, parseRelayURL, sys.DMRelayListCache)
return ml
}
func (sys *System) FetchGoodWikiRelayList(ctx context.Context, pubkey nostr.PubKey) GenericList[string, RelayURL] {
sys.goodWikiRelayListCacheOnce.Do(func() {
if sys.GoodWikiRelayListCache == nil {
sys.GoodWikiRelayListCache = cache_memory.New[GenericList[string, RelayURL]](1000)
}
})
ml, _ := fetchGenericList(sys, ctx, pubkey, 10102, kind_10102, parseRelayURL, sys.GoodWikiRelayListCache)
return ml
}
func (sys *System) FetchRelaySets(ctx context.Context, pubkey nostr.PubKey) GenericSets[string, RelayURL] {
sys.relaySetsCacheOnce.Do(func() {
if sys.RelaySetsCache == nil {