Esempio n. 1
0
// get command
func getValue(c *client.GhostClient, args []string) (string, error) {
	if len(args) != 1 {
		return "", errors.New(fmt.Sprintf("wrong number of arguments to GET: need 1, get %d", len(args)))
	}

	return c.Get(args[0])
}
Esempio n. 2
0
func benchmarkServerGet(c *client.GhostClient) result {
	var wg sync.WaitGroup
	keys, vals := initTestData("get", requests, size, keyrange)
	populateTestDataServer(c, keys, vals)

	start := time.Now()
	for i := 0; i < requests; i++ {
		wg.Add(1)
		go func(i int) {
			c.Get(keys[i])
			wg.Done()
		}(i)
	}
	wg.Wait()

	latency := time.Since(start)

	return result{
		totTime: latency,
		reqSec:  float64(requests) / latency.Seconds(),
	}
}