Merge pull request #25 from gogf/master

fix更新
This commit is contained in:
jroam
2019-06-14 10:50:05 +08:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@ -91,8 +91,13 @@ func (c *memCache) getExpireSet(expire int64) (expireSet *gset.Set) {
// It creates and returns a new set for <expire> if it does not exist.
func (c *memCache) getOrNewExpireSet(expire int64) (expireSet *gset.Set) {
if expireSet = c.getExpireSet(expire); expireSet == nil {
c.expireSetMu.Lock()
c.expireSets[expire] = gset.New()
expireSet = gset.New()
c.expireSetMu.Lock()
if es, ok := c.expireSets[expire]; ok {
expireSet = es
} else {
c.expireSets[expire] = expireSet
}
c.expireSetMu.Unlock()
}
return

View File

@ -19,6 +19,9 @@ import (
// 递归添加目录下的文件
func (sp *SPath) updateCacheByPath(path string) {
if sp.cache == nil {
return
}
sp.addToCache(path, path)
}