diff --git a/sdk/mutes.go b/sdk/mutes.go index 5c45953..d5a2a6e 100644 --- a/sdk/mutes.go +++ b/sdk/mutes.go @@ -5,6 +5,6 @@ import "context" type MuteList = GenericList[Follow] func (sys *System) FetchMuteList(ctx context.Context, pubkey string) MuteList { - ml, _ := fetchGenericList[Follow](sys, ctx, pubkey, 10000, parseFollow, nil, false) + ml, _ := fetchGenericList(sys, ctx, pubkey, 10000, parseFollow, sys.MuteListCache, false) return ml } diff --git a/sdk/system.go b/sdk/system.go index b6460ef..b3b084f 100644 --- a/sdk/system.go +++ b/sdk/system.go @@ -16,6 +16,7 @@ import ( type System struct { RelayListCache cache.Cache32[RelayList] FollowListCache cache.Cache32[FollowList] + MuteListCache cache.Cache32[FollowList] MetadataCache cache.Cache32[ProfileMetadata] Hints hints.HintsDB Pool *nostr.SimplePool @@ -54,6 +55,7 @@ func NewSystem(mods ...SystemModifier) *System { sys := &System{ RelayListCache: cache_memory.New32[RelayList](1000), FollowListCache: cache_memory.New32[FollowList](1000), + MuteListCache: cache_memory.New32[FollowList](1000), MetadataCache: cache_memory.New32[ProfileMetadata](1000), RelayListRelays: NewRelayStream("wss://purplepag.es", "wss://user.kindpag.es", "wss://relay.nos.social"), FollowListRelays: NewRelayStream("wss://purplepag.es", "wss://user.kindpag.es", "wss://relay.nos.social"), @@ -173,6 +175,12 @@ func WithFollowListCache(cache cache.Cache32[FollowList]) SystemModifier { } } +func WithMuteListCache(cache cache.Cache32[FollowList]) SystemModifier { + return func(sys *System) { + sys.MuteListCache = cache + } +} + func WithMetadataCache(cache cache.Cache32[ProfileMetadata]) SystemModifier { return func(sys *System) { sys.MetadataCache = cache