Compare commits

..

No commits in common. "master" and "v2.1.0" have entirely different histories.

3 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2012-2019 Patrick Mylund Nielsen and the go-cache contributors Copyright (c) 2012-2017 Patrick Mylund Nielsen and the go-cache contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1555,7 +1555,7 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
tc := New(exp, 0) tc := New(exp, 0)
keys := make([]string, n) keys := make([]string, n)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
k := "foo" + strconv.Itoa(i) k := "foo" + strconv.Itoa(n)
keys[i] = k keys[i] = k
tc.Set(k, "bar", DefaultExpiration) tc.Set(k, "bar", DefaultExpiration)
} }
@ -1563,12 +1563,12 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
wg.Add(n) wg.Add(n)
for _, v := range keys { for _, v := range keys {
go func(k string) { go func() {
for j := 0; j < each; j++ { for j := 0; j < each; j++ {
tc.Get(k) tc.Get(v)
} }
wg.Done() wg.Done()
}(v) }()
} }
b.StartTimer() b.StartTimer()
wg.Wait() wg.Wait()

View File

@ -65,7 +65,7 @@ func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
tsc := unexportedNewSharded(exp, 0, 20) tsc := unexportedNewSharded(exp, 0, 20)
keys := make([]string, n) keys := make([]string, n)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
k := "foo" + strconv.Itoa(i) k := "foo" + strconv.Itoa(n)
keys[i] = k keys[i] = k
tsc.Set(k, "bar", DefaultExpiration) tsc.Set(k, "bar", DefaultExpiration)
} }
@ -73,12 +73,12 @@ func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
wg.Add(n) wg.Add(n)
for _, v := range keys { for _, v := range keys {
go func(k string) { go func() {
for j := 0; j < each; j++ { for j := 0; j < each; j++ {
tsc.Get(k) tsc.Get(v)
} }
wg.Done() wg.Done()
}(v) }()
} }
b.StartTimer() b.StartTimer()
wg.Wait() wg.Wait()