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
+33
View File
@@ -39,6 +39,39 @@ func (sys *System) FetchMuteList(ctx context.Context, pubkey nostr.PubKey) Gener
return ml
}
func (sys *System) FetchMediaFollowList(ctx context.Context, pubkey nostr.PubKey) GenericList[nostr.PubKey, ProfileRef] {
sys.mediaFollowListCacheOnce.Do(func() {
if sys.MediaFollowListCache == nil {
sys.MediaFollowListCache = cache_memory.New[GenericList[nostr.PubKey, ProfileRef]](1000)
}
})
ml, _ := fetchGenericList(sys, ctx, pubkey, 10020, kind_10020, parseProfileRef, sys.MediaFollowListCache)
return ml
}
func (sys *System) FetchGoodWikiAuthorList(ctx context.Context, pubkey nostr.PubKey) GenericList[nostr.PubKey, ProfileRef] {
sys.goodWikiAuthorListCacheOnce.Do(func() {
if sys.GoodWikiAuthorListCache == nil {
sys.GoodWikiAuthorListCache = cache_memory.New[GenericList[nostr.PubKey, ProfileRef]](1000)
}
})
ml, _ := fetchGenericList(sys, ctx, pubkey, 10101, kind_10101, parseProfileRef, sys.GoodWikiAuthorListCache)
return ml
}
func (sys *System) FetchGitAuthorList(ctx context.Context, pubkey nostr.PubKey) GenericList[nostr.PubKey, ProfileRef] {
sys.gitAuthorListCacheOnce.Do(func() {
if sys.GitAuthorListCache == nil {
sys.GitAuthorListCache = cache_memory.New[GenericList[nostr.PubKey, ProfileRef]](1000)
}
})
ml, _ := fetchGenericList(sys, ctx, pubkey, 10017, kind_10017, parseProfileRef, sys.GitAuthorListCache)
return ml
}
func (sys *System) FetchFollowSets(ctx context.Context, pubkey nostr.PubKey) GenericSets[nostr.PubKey, ProfileRef] {
sys.followSetsCacheOnce.Do(func() {
if sys.FollowSetsCache == nil {