You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
585 B
Go
38 lines
585 B
Go
//////////////////////////////////////////////////////////////////////
|
|
//
|
|
// DO NOT EDIT THIS PART
|
|
// Your task is to edit `main.go`
|
|
//
|
|
|
|
package main
|
|
|
|
import (
|
|
"strconv"
|
|
"sync"
|
|
)
|
|
|
|
const (
|
|
cycles = 15
|
|
callsPerCycle = 100
|
|
)
|
|
|
|
// RunMockServer simulates a running server, which accesses the
|
|
// key-value database through our cache
|
|
func RunMockServer(cache *KeyStoreCache) {
|
|
var wg sync.WaitGroup
|
|
|
|
for c := 0; c < cycles; c++ {
|
|
wg.Add(1)
|
|
go func() {
|
|
for i := 0; i < callsPerCycle; i++ {
|
|
|
|
cache.Get("Test" + strconv.Itoa(i))
|
|
|
|
}
|
|
wg.Done()
|
|
}()
|
|
}
|
|
|
|
wg.Wait()
|
|
}
|