mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
nutzer einladen + sesssion cache correct clear
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user