This commit is contained in:
withchao 2025-02-14 11:28:56 +08:00
parent ea776efa96
commit 64fbbe0b3d

View File

@ -7,10 +7,18 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
)
var (
globalOnlineCache cache.OnlineCache
globalOnlineOnce sync.Once
)
func NewOnlineCache() cache.OnlineCache {
return &onlineCache{
user: make(map[string]map[int32]struct{}),
}
globalOnlineOnce.Do(func() {
globalOnlineCache = &onlineCache{
user: make(map[string]map[int32]struct{}),
}
})
return globalOnlineCache
}
type onlineCache struct {