Example #1
0
func buildMapSeries(size int) concurrentmap.ConcurrentMap {
	cMap := concurrentmap.ConcurrentMap1{}
	cMap.ConstructMap(size)

	for i := 0; i < numberOfTests; i++ {
		s := strconv.Itoa(i)
		cMap.Put(s, s)
	}
	return &cMap
}
Example #2
0
func buildMapConcurrent(size int, threads int, done chan int64) concurrentmap.ConcurrentMap {

	cMap := concurrentmap.ConcurrentMap1{}
	cMap.ConstructMap(size)

	for i := 0; i < threads; i++ {
		go writeConcurrent(&cMap, threads, i, done)
	}

	return &cMap
}
Example #3
0
func mapExample() {
	cMap := concurrentmap.ConcurrentMap1{}
	cMap.ConstructMap(111)
	fmt.Println("Writing some values...")

	cMap.Put("1", "cat")
	cMap.Put("2", "dog")
	cMap.Put("3", "zebra")

	fmt.Println("Reading...")

	v, e := cMap.Get("1")
	fmt.Println("Key: 1,", "Value:", v, e)
	v, e = cMap.Get("2")
	fmt.Println("Key: 2,", "Value:", v, e)
	v, e = cMap.Get("3")
	fmt.Println("Key: 3,", "Value:", v, e)

	cMap.DestructMap()
	<-time.After(time.Second * 2)

}