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 NewConversationLocalCache(client rpcclient.ConversationRpcClient, cli redis.UniversalClient) *ConversationLocalCache {
return &ConversationLocalCache{
lc := config.Config.LocalCache.Conversation
x := &ConversationLocalCache{
client: client,
local: localcache.New[any](
localcache.WithLocalSlotNum(config.Config.LocalCache.Conversation.SlotNum),
localcache.WithLocalSlotSize(config.Config.LocalCache.Conversation.SlotSize),
localcache.WithLocalSlotNum(lc.SlotNum),
localcache.WithLocalSlotSize(lc.SlotSize),
),
}
go subscriberRedisDeleteCache(context.Background(), cli, lc.Topic, x.local.DelLocal)
return x
}
type ConversationLocalCache struct {