github.com/easierway/concurrent_map@v1.0.0/concurrent_map_benchmark_adapter.go (about)

     1  package concurrent_map
     2  
     3  type ConcurrentMapBenchmarkAdapter struct {
     4  	cm *ConcurrentMap
     5  }
     6  
     7  func (m *ConcurrentMapBenchmarkAdapter) Set(key interface{}, value interface{}) {
     8  	m.cm.Set(StrKey(key.(string)), value)
     9  }
    10  
    11  func (m *ConcurrentMapBenchmarkAdapter) Get(key interface{}) (interface{}, bool) {
    12  	return m.cm.Get(StrKey(key.(string)))
    13  }
    14  
    15  func (m *ConcurrentMapBenchmarkAdapter) Del(key interface{}) {
    16  	m.cm.Del(StrKey(key.(string)))
    17  }
    18  
    19  func CreateConcurrentMapBenchmarkAdapter(numOfPartitions int) *ConcurrentMapBenchmarkAdapter {
    20  	conMap := CreateConcurrentMap(numOfPartitions)
    21  	return &ConcurrentMapBenchmarkAdapter{conMap}
    22  }