修复normal读取数据panic问题
This commit is contained in:
@ -234,15 +234,15 @@ func (n *normal) Exist(key interface{}) bool {
|
||||
return exist
|
||||
}
|
||||
|
||||
// GetAll 读取全部数据使用的是原始数据深拷贝,避免获取到全部数据之后,直接读取导致并发读写
|
||||
// GetAll 读取全部数据使用的是原始数据深拷贝
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:36 下午 2021/2/23
|
||||
func (n *normal) GetAll() map[interface{}]interface{} {
|
||||
result := make(map[interface{}]interface{})
|
||||
n.lock.RLock()
|
||||
defer n.lock.RUnlock()
|
||||
n.RLock()
|
||||
defer n.RUnlock()
|
||||
for key, val := range n.data {
|
||||
result[key] = val
|
||||
}
|
||||
|
Reference in New Issue
Block a user