diff --git a/.travis.yml b/.travis.yml index c447fde..eafe14d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,5 @@ - golint . - go test -cover -race -count=1 -timeout=30s -run . - go test -covermode=count -coverprofile=coverage.out -timeout=90s -run . - - '[ ! -z "$COVERALLS_TOKEN" ] && $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN' + - if [ "$TRAVIS_BRANCH" = "master" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi - cd bench; go test -run=Bench.* -bench=. -benchmem; cd ..diff --git a/bench/bench_test.go b/bench/bench_test.go new file mode 100644 index 0000000..b4e9d5e --- /dev/null +++ b/bench/bench_test.go @@ -0,0 +1,37 @@ +package bench + +import ( + "fmt" + "testing" + "time" + + ttlcache "github.com/ReneKroon/ttlcache/v2" +) + +func BenchmarkCacheSetWithoutTTL(b *testing.B) { + cache := ttlcache.NewCache() + defer cache.Close() + + for n := 0; n < b.N; n++ { + cache.Set(fmt.Sprint(n%1000000), "value") + } +} + +func BenchmarkCacheSetWithGlobalTTL(b *testing.B) { + cache := ttlcache.NewCache() + defer cache.Close() + + cache.SetTTL(time.Duration(50 * time.Millisecond)) + for n := 0; n < b.N; n++ { + cache.Set(fmt.Sprint(n%1000000), "value") + } +} + +func BenchmarkCacheSetWithTTL(b *testing.B) { + cache := ttlcache.NewCache() + defer cache.Close() + + for n := 0; n < b.N; n++ { + cache.SetWithTTL(fmt.Sprint(n%1000000), "value", time.Duration(50*time.Millisecond)) + } +} diff --git a/debian/changelog b/debian/changelog index fc61bb3..3e2d141 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +golang-github-renekroon-ttlcache (2.9.0+ds+git20211107.1.6eff24f-1) UNRELEASED; urgency=low + + * New upstream snapshot. + + -- Debian Janitor Wed, 17 Nov 2021 13:03:05 -0000 + golang-github-renekroon-ttlcache (2.9.0+ds-1) unstable; urgency=medium * New upstream release.