nutzer einladen + sesssion cache correct clear

This commit is contained in:
Simon Martens
2025-05-24 10:57:31 +02:00
parent a46e2bc474
commit 74de26f560
7 changed files with 226 additions and 124 deletions

View File

@@ -99,6 +99,28 @@ func (c *UserSessionCache) Delete(sessionTokenClear string) {
}
}
func (c *UserSessionCache) DeleteSessionByUserID(uid string) {
if uid == "" {
return
}
c.cache.Range(func(key, value any) bool {
entry, ok := value.(*cacheEntry)
if !ok {
c.cache.Delete(key)
return true
}
if entry.user.Id == uid {
c.cache.Delete(key)
c.mu.Lock()
c.approximateSize--
c.mu.Unlock()
}
return true
})
}
func (c *UserSessionCache) Clear() {
c.cache.Clear()
c.mu.Lock()