Reviles ConcurrentMap "private" variables to json marshal. 可以用这个持久化
()
| 318 | //Reviles ConcurrentMap "private" variables to json marshal. |
| 319 | // 可以用这个持久化 |
| 320 | func (m ConcurrentHashMap) MarshalJSON() ([]byte, error) { |
| 321 | // Create a temporary map, which will hold all item spread across shards. |
| 322 | tmp := make(map[string]interface{}) |
| 323 | |
| 324 | // Insert items to temporary map. |
| 325 | for item := range m.IterBuffered() { |
| 326 | tmp[item.Key] = item.Val |
| 327 | } |
| 328 | return json.Marshal(tmp) |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | * @param: 性能极其优异的哈希算法 |
nothing calls this directly
no test coverage detected