mirror of
https://github.com/astaxie/beego.git
synced 2025-06-11 04:30:39 +00:00
cache, context, session: add lock to fix inconsistent field protection
This commit is contained in:
3
cache/memory.go
vendored
3
cache/memory.go
vendored
@ -218,9 +218,12 @@ func (bc *MemoryCache) vacuum() {
|
||||
}
|
||||
for {
|
||||
<-time.After(bc.dur)
|
||||
bc.RLock()
|
||||
if bc.items == nil {
|
||||
bc.RUnlock()
|
||||
return
|
||||
}
|
||||
bc.RUnlock()
|
||||
if keys := bc.expiredKeys(); len(keys) != 0 {
|
||||
bc.clearItems(keys)
|
||||
}
|
||||
|
Reference in New Issue
Block a user