mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-11 12:36:00 +08:00
feat: msg local cache
This commit is contained in:
@@ -16,6 +16,7 @@ func WithRedisDeleteSubscribe(topic string, cli redis.UniversalClient) Option {
|
||||
}
|
||||
msg := cli.Subscribe(context.Background(), topic).Channel()
|
||||
for m := range msg {
|
||||
log.ZDebug(context.Background(), "WithRedisDeleteSubscribe delete", "topic", m.Channel, "payload", m.Payload)
|
||||
var key []string
|
||||
if err := json.Unmarshal([]byte(m.Payload), &key); err != nil {
|
||||
log.ZError(context.Background(), "WithRedisDeleteSubscribe json unmarshal error", err, "topic", topic, "payload", m.Payload)
|
||||
|
||||
@@ -33,9 +33,7 @@ type cache[V any] struct {
|
||||
|
||||
func (c *cache[V]) onEvict(key string, value V) {
|
||||
for k := range c.link.Del(key) {
|
||||
if key != k {
|
||||
c.local.Del(k)
|
||||
}
|
||||
c.local.Del(k)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user