mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
addCount should only be executed when there is data insertion
This commit is contained in:
@@ -109,7 +109,6 @@ func (dict *ConcurrentDict) Put(key string, val interface{}) (result int) {
|
||||
hashCode := fnv32(key)
|
||||
index := dict.spread(hashCode)
|
||||
s := dict.getShard(index)
|
||||
dict.addCount()
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
@@ -117,6 +116,7 @@ func (dict *ConcurrentDict) Put(key string, val interface{}) (result int) {
|
||||
s.m[key] = val
|
||||
return 0
|
||||
}
|
||||
dict.addCount()
|
||||
s.m[key] = val
|
||||
return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user