concurrent-map icon indicating copy to clipboard operation
concurrent-map copied to clipboard

a thread-safe concurrent map for go

Results 41 concurrent-map issues
Sort by recently updated
recently updated
newest added

If the map values are structs, sometimes there is a need to update a certain value inside one of the structs atomically, to ensure the updated value is consistent. Currently...

// Creates a new concurrent map. func New[V any]() ConcurrentMap[string, V] { return create[string, V](fnv32) }

`type DetailInfo struct { Summary Summary `json:"summary"` Detail map[string]*Url_Request_Info `json:"detail"` } type Summary struct { Url_Request_Info Url_Request_Info `json:"url_request_info"` Paths []string `json:"paths"` } type Url_Request_Info struct{ Total int `json:"total"` Code_200 int...

I want to use this feature in my place. I think it's useful for anyone.

``` // Keys returns all keys as []string func (m ConcurrentMap[V]) Keys() []string { count := m.Count() ch := make(chan string, count) go func() { // Foreach shard. wg :=...

Works right out of the box

Because it is a single-node map, the value of the SHARD_COUNT cannot be particularly large, so it is easy to randomly transfer a large number of keys to a slot,...

有的时候希望在取得Value的时候,在锁持有期间内对Value进行一些判断操作然后再更新值。 现阶段只能通过Upsert()方法来实现,但是如果不进行更新时,就需要upsert相同的元素,但其实是没有必要的。

I noticed issue #135 , so I added a function `NewGeneric[K comparable, V any]()` to create a generic type Key map. I also wrote 2 tests and 2 benchmark test...