feat: local cache

This commit is contained in:
withchao
2024-01-15 16:02:34 +08:00
parent c9193302a8
commit ad5e4e1540
4 changed files with 41 additions and 9 deletions
+6 -3
View File
@@ -10,13 +10,16 @@ import (
)
func NewGroupLocalCache(client rpcclient.GroupRpcClient, cli redis.UniversalClient) *GroupLocalCache {
return &GroupLocalCache{
lc := config.Config.LocalCache.Group
x := &GroupLocalCache{
client: client,
local: localcache.New[any](
localcache.WithLocalSlotNum(config.Config.LocalCache.Group.SlotNum),
localcache.WithLocalSlotSize(config.Config.LocalCache.Group.SlotSize),
localcache.WithLocalSlotNum(lc.SlotNum),
localcache.WithLocalSlotSize(lc.SlotSize),
),
}
go subscriberRedisDeleteCache(context.Background(), cli, lc.Topic, x.local.DelLocal)
return x
}
type GroupLocalCache struct {