1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 04:40:49 +00:00

Merge pull request #3390 from astaxie/FixDataRaceOnCache

Fix  #3354
This commit is contained in:
astaxie 2018-11-14 15:58:20 +08:00 committed by GitHub
commit 2c46877b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
cache/memory.go vendored
View File

@ -209,7 +209,11 @@ func (bc *MemoryCache) StartAndGC(config string) error {
// check expiration.
func (bc *MemoryCache) vacuum() {
if bc.Every < 1 {
bc.RLock()
every := bc.Every
bc.RUnlock()
if every < 1 {
return
}
for {