updated cache

This commit is contained in:
2025-12-01 21:12:46 +01:00
parent 925dc319e8
commit 2372da942a
2 changed files with 67 additions and 46 deletions

14
util/cache/structs.go vendored
View File

@@ -2,15 +2,15 @@ package cache
import (
"sync"
"sync/atomic"
)
type ShardedCache struct {
shards []*shard
shardMask uint32
type Cache struct {
mu sync.Mutex
state atomic.Pointer[mappings]
}
type shard struct {
mu sync.RWMutex
s2c map[string]string // serverId -> channelId
c2s map[string]string // channelId -> serverId
type mappings struct {
s2c map[string]string
c2s map[string]string
}