concurrent-map
concurrent-map copied to clipboard
a thread-safe concurrent map for go
Enhancement: If concurrent-map is supposed to behave the same as the plain map, then the allowed key types should be the same and the type map[interface{}]interface{} should be supported.
Closes #85
For example, In regular map ``` var data = map[string]map[string]string{} data["a"] = map[string]string{} data["b"] = make(map[string]string) data["c"] = make(map[string]string) data["a"]["w"] = "x" data["b"]["w"] = "x" data["c"]["w"] = "x" ``` How...
hello,as the title ,can you add a clone func to deep copy a cmap to a new one? and for the values like string,add a function maybe named append to...
```go func (m ConcurrentMap) Keys() []string { count := m.Count() time.Sleep(5*time.Second) ch := make(chan string, count) go func() { // Foreach shard. wg := sync.WaitGroup{} wg.Add(SHARD_COUNT) for _, shard :=...
I have personally had a requirement to do multiple consecutive operations using the same key with the requirement that nothing can change from start to end. To enable this, I...
When we are traversing frequently, using IterBuffered() will generate a lot of memory garbage, which will cause a lot of burden on the GC of the program. At this time,...
cann't help asking this: why is shard count fixed 32, not a variable? :)
The current implementation leaves non-zero possibility of false sharing between `ConcurrentMapShared` structs since they're allocated on heap in a loop in the `New` function. Hence, there is a possibility that...
1. optimize mset method, reduce lock count 2. add mremove method