github.com/nibnait/go-learn@v0.0.0-20220227013611-dfa47ea6d2da/src/test/chapter/ch9/02_maps/concurrent_map_benchmark_adapter.go (about) 1 package maps 2 3 import "github.com/easierway/concurrent_map" 4 5 type ConcurrentMapBenchmarkAdapter struct { 6 cm *concurrent_map.ConcurrentMap 7 } 8 9 func (m *ConcurrentMapBenchmarkAdapter) Set(key interface{}, value interface{}) { 10 m.cm.Set(concurrent_map.StrKey(key.(string)), value) 11 } 12 13 func (m *ConcurrentMapBenchmarkAdapter) Get(key interface{}) (interface{}, bool) { 14 return m.cm.Get(concurrent_map.StrKey(key.(string))) 15 } 16 17 func (m *ConcurrentMapBenchmarkAdapter) Del(key interface{}) { 18 m.cm.Del(concurrent_map.StrKey(key.(string))) 19 } 20 21 func CreateConcurrentMapBenchmarkAdapter(numOfPartitions int) *ConcurrentMapBenchmarkAdapter { 22 conMap := concurrent_map.CreateConcurrentMap(numOfPartitions) 23 return &ConcurrentMapBenchmarkAdapter{conMap} 24 }