diff --git a/FUTURE.md b/FUTURE.md index 28eaeff..6bbb58e 100644 --- a/FUTURE.md +++ b/FUTURE.md @@ -1,11 +1,14 @@ ## ✒ 未来版本的新特性 (Features in future versions) +### v0.6.x + +* [ ] 梳理代码,优化代码风格,精简部分代码和注释 +* [ ] 完善监控上报器,提供更多缓存信息查询的方法 + ### v0.5.x * [ ] ~~提供一个清空并设置全量值的方法,方便定时数据的全量替换~~ 目前还找不到一个合适的设计去加入这个功能,并且也不是非常刚需,通过业务手段可以处理,所以先不加 -* [ ] 完善监控上报器,提供更多缓存信息查询的方法 -* [ ] 梳理代码,优化代码风格 ### v0.4.x diff --git a/HISTORY.md b/HISTORY.md index 57da66d..d3d0dbe 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,12 @@ ## ✒ 历史版本的特性介绍 (Features in old versions) +### v0.6.0-alpha + +> 此版本发布于 2024-01-13 + +* 受小徒弟的建议,进行 Loader 代码的调整 +* 把 cache 结构去掉,精简这部分设计 + ### v0.5.0 > 此版本发布于 2023-11-30 diff --git a/README.en.md b/README.en.md index 128fffd..a835b6b 100644 --- a/README.en.md +++ b/README.en.md @@ -2,7 +2,7 @@ [![Go Doc](_icons/godoc.svg)](https://pkg.go.dev/github.com/FishGoddess/cachego) [![License](_icons/license.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) -[![License](_icons/coverage.svg)](_icons/coverage.svg) +[![Coverage](_icons/coverage.svg)](_icons/coverage.svg) ![Test](https://github.com/FishGoddess/cachego/actions/workflows/test.yml/badge.svg) **cachego** is an api friendly memory-based cache for [GoLang](https://golang.org) applications. diff --git a/README.md b/README.md index 32c681e..8a07100 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Go Doc](_icons/godoc.svg)](https://pkg.go.dev/github.com/FishGoddess/cachego) [![License](_icons/license.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) -[![License](_icons/coverage.svg)](_icons/coverage.svg) +[![Coverage](_icons/coverage.svg)](_icons/coverage.svg) ![Test](https://github.com/FishGoddess/cachego/actions/workflows/test.yml/badge.svg) **cachego** 是一个拥有分片机制的轻量级内存缓存库,API 友好,支持多种数据淘汰机制,可以应用于所有的 [GoLang](https://golang.org) 应用程序中。 diff --git a/_icons/coverage.svg b/_icons/coverage.svg index be8453f..68ffdc7 100644 --- a/_icons/coverage.svg +++ b/_icons/coverage.svg @@ -10,7 +10,7 @@ coverage coverage - 98% - 98% + 97% + 97% \ No newline at end of file diff --git a/cache_test.go b/cache_test.go index 4172fbb..7abd5cc 100644 --- a/cache_test.go +++ b/cache_test.go @@ -252,7 +252,7 @@ func testCacheImplement(t *testing.T, cache Cache) { } } -// go test -v -cover=^TestNewCache$ +// go test -v -cover -count=1 -test.cpu=1=^TestNewCache$ func TestNewCache(t *testing.T) { cache := NewCache() @@ -296,7 +296,7 @@ func TestNewCache(t *testing.T) { cache = NewCache(WithLRU(0)) } -// go test -v -cover=^TestNewCacheWithReport$ +// go test -v -cover -count=1 -test.cpu=1=^TestNewCacheWithReport$ func TestNewCacheWithReport(t *testing.T) { cache, reporter := NewCacheWithReport() @@ -314,7 +314,7 @@ func TestNewCacheWithReport(t *testing.T) { } } -// go test -v -cover=^TestRunGCTask$ +// go test -v -cover -count=1 -test.cpu=1=^TestRunGCTask$ func TestRunGCTask(t *testing.T) { cache := new(testCache) diff --git a/cache_type_test.go b/cache_type_test.go index fe82ce1..fba7442 100644 --- a/cache_type_test.go +++ b/cache_type_test.go @@ -16,7 +16,7 @@ package cachego import "testing" -// go test -v -cover -run=^TestCacheType$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestCacheType$ func TestCacheType(t *testing.T) { if standard.String() != string(standard) { t.Fatalf("standard.String() %s is wrong", standard.String()) diff --git a/config_test.go b/config_test.go index 5758796..6491aa5 100644 --- a/config_test.go +++ b/config_test.go @@ -87,7 +87,7 @@ func isConfigEquals(conf1 *config, conf2 *config) bool { return true } -// go test -v -cover -run=^TestApplyOptions$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestApplyOptions$ func TestApplyOptions(t *testing.T) { got := &config{ shardings: 0, diff --git a/entry_test.go b/entry_test.go index dbcec72..ed3e08d 100644 --- a/entry_test.go +++ b/entry_test.go @@ -24,7 +24,7 @@ const ( testDurationGap = 10 * time.Microsecond ) -// go test -v -cover -run=^TestNewEntry$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestNewEntry$ func TestNewEntry(t *testing.T) { e := newEntry("key", "value", 0, now) @@ -69,7 +69,7 @@ func TestNewEntry(t *testing.T) { } } -// go test -v -cover -run=^TestEntrySetup$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestEntrySetup$ func TestEntrySetup(t *testing.T) { e := newEntry("key", "value", 0, now) diff --git a/global_test.go b/global_test.go index 9e4ebad..9a113b3 100644 --- a/global_test.go +++ b/global_test.go @@ -29,7 +29,7 @@ func BenchmarkHash(b *testing.B) { } } -// go test -v -cover -run=^TestHash$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestHash$ func TestHash(t *testing.T) { hash := hash("test") if hash < 0 { @@ -37,7 +37,7 @@ func TestHash(t *testing.T) { } } -// go test -v -cover -run=^TestNow$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestNow$ func TestNow(t *testing.T) { got := now() expect := time.Now().UnixNano() @@ -47,7 +47,7 @@ func TestNow(t *testing.T) { } } -// go test -v -cover -run=^TestSetMapInitialCap$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestSetMapInitialCap$ func TestSetMapInitialCap(t *testing.T) { oldInitialCap := mapInitialCap @@ -67,7 +67,7 @@ func TestSetMapInitialCap(t *testing.T) { } } -// go test -v -cover -run=^TestSetSliceInitialCap$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestSetSliceInitialCap$ func TestSetSliceInitialCap(t *testing.T) { oldInitialCap := sliceInitialCap diff --git a/lfu_test.go b/lfu_test.go index b4359e5..edaaf51 100644 --- a/lfu_test.go +++ b/lfu_test.go @@ -29,13 +29,13 @@ func newTestLFUCache() *lfuCache { return newLFUCache(conf).(*lfuCache) } -// go test -v -cover -run=^TestLFUCache$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLFUCache$ func TestLFUCache(t *testing.T) { cache := newTestLFUCache() testCacheImplement(t, cache) } -// go test -v -cover -run=^TestLFUCacheEvict$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLFUCacheEvict$ func TestLFUCacheEvict(t *testing.T) { cache := newTestLFUCache() @@ -85,7 +85,7 @@ func TestLFUCacheEvict(t *testing.T) { } } -// go test -v -cover -run=^TestLFUCacheEvictSimulate$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLFUCacheEvictSimulate$ func TestLFUCacheEvictSimulate(t *testing.T) { cache := newTestLFUCache() diff --git a/load_test.go b/load_test.go index b0948dd..92fbf09 100644 --- a/load_test.go +++ b/load_test.go @@ -67,7 +67,7 @@ func (tlc *testLoadCache) Load(key string, ttl time.Duration, load func() (value return tlc.loader.Load(key, ttl, load) } -// go test -v -cover -run=^TestNewLoader$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestNewLoader$ func TestNewLoader(t *testing.T) { loader := NewLoader(false) if loader.group != nil { @@ -80,7 +80,7 @@ func TestNewLoader(t *testing.T) { } } -// go test -v -cover -run=^TestLoaderLoad$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLoaderLoad$ func TestLoaderLoad(t *testing.T) { cache := newTestLoadCache(false) loadCount := 0 diff --git a/lru_test.go b/lru_test.go index aa9dd82..0060ddf 100644 --- a/lru_test.go +++ b/lru_test.go @@ -28,13 +28,13 @@ func newTestLRUCache() *lruCache { return newLRUCache(conf).(*lruCache) } -// go test -v -cover -run=^TestLRUCache$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLRUCache$ func TestLRUCache(t *testing.T) { cache := newTestLRUCache() testCacheImplement(t, cache) } -// go test -v -cover -run=^TestLRUCacheEvict$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLRUCacheEvict$ func TestLRUCacheEvict(t *testing.T) { cache := newTestLRUCache() @@ -74,7 +74,7 @@ func TestLRUCacheEvict(t *testing.T) { } } -// go test -v -cover -run=^TestLRUCacheEvictSimulate$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestLRUCacheEvictSimulate$ func TestLRUCacheEvictSimulate(t *testing.T) { cache := newTestLRUCache() diff --git a/option_test.go b/option_test.go index 5417b65..5a64b8e 100644 --- a/option_test.go +++ b/option_test.go @@ -19,7 +19,7 @@ import ( "time" ) -// go test -v -cover -run=^TestWithCacheName$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithCacheName$ func TestWithCacheName(t *testing.T) { got := &config{cacheName: ""} expect := &config{cacheName: "-"} @@ -30,7 +30,7 @@ func TestWithCacheName(t *testing.T) { } } -// go test -v -cover -run=^TestWithLRU$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithLRU$ func TestWithLRU(t *testing.T) { got := &config{cacheType: standard, maxEntries: 0} expect := &config{cacheType: lru, maxEntries: 666} @@ -41,7 +41,7 @@ func TestWithLRU(t *testing.T) { } } -// go test -v -cover -run=^TestWithLFU$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithLFU$ func TestWithLFU(t *testing.T) { got := &config{cacheType: standard, maxEntries: 0} expect := &config{cacheType: lfu, maxEntries: 999} @@ -52,7 +52,7 @@ func TestWithLFU(t *testing.T) { } } -// go test -v -cover -run=^TestWithShardings$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithShardings$ func TestWithShardings(t *testing.T) { got := &config{shardings: 0} expect := &config{shardings: 1024} @@ -63,7 +63,7 @@ func TestWithShardings(t *testing.T) { } } -// go test -v -cover -run=^TestWithDisableSingleflight$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithDisableSingleflight$ func TestWithDisableSingleflight(t *testing.T) { got := &config{singleflight: true} expect := &config{singleflight: false} @@ -74,7 +74,7 @@ func TestWithDisableSingleflight(t *testing.T) { } } -// go test -v -cover -run=^TestWithGC$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithGC$ func TestWithGC(t *testing.T) { got := &config{gcDuration: 0} expect := &config{gcDuration: 1024} @@ -85,7 +85,7 @@ func TestWithGC(t *testing.T) { } } -// go test -v -cover -run=^TestWithMaxScans$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithMaxScans$ func TestWithMaxScans(t *testing.T) { got := &config{maxScans: 0} expect := &config{maxScans: 1024} @@ -96,7 +96,7 @@ func TestWithMaxScans(t *testing.T) { } } -// go test -v -cover -run=^TestWithMaxEntries$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithMaxEntries$ func TestWithMaxEntries(t *testing.T) { got := &config{maxEntries: 0} expect := &config{maxEntries: 1024} @@ -107,7 +107,7 @@ func TestWithMaxEntries(t *testing.T) { } } -// go test -v -cover -run=^TestWithNow$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithNow$ func TestWithNow(t *testing.T) { now := func() int64 { return 0 @@ -122,7 +122,7 @@ func TestWithNow(t *testing.T) { } } -// go test -v -cover -run=^TestWithHash$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithHash$ func TestWithHash(t *testing.T) { hash := func(key string) int { return 0 @@ -137,7 +137,7 @@ func TestWithHash(t *testing.T) { } } -// go test -v -cover -run=^TestWithRecordMissed$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithRecordMissed$ func TestWithRecordMissed(t *testing.T) { got := &config{recordMissed: false} expect := &config{recordMissed: true} @@ -148,7 +148,7 @@ func TestWithRecordMissed(t *testing.T) { } } -// go test -v -cover -run=^TestWithRecordHit$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithRecordHit$ func TestWithRecordHit(t *testing.T) { got := &config{recordHit: false} expect := &config{recordHit: true} @@ -159,7 +159,7 @@ func TestWithRecordHit(t *testing.T) { } } -// go test -v -cover -run=^TestWithRecordGC$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithRecordGC$ func TestWithRecordGC(t *testing.T) { got := &config{recordGC: false} expect := &config{recordGC: true} @@ -170,7 +170,7 @@ func TestWithRecordGC(t *testing.T) { } } -// go test -v -cover -run=^TestWithRecordLoad$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithRecordLoad$ func TestWithRecordLoad(t *testing.T) { got := &config{recordLoad: false} expect := &config{recordLoad: true} @@ -181,7 +181,7 @@ func TestWithRecordLoad(t *testing.T) { } } -// go test -v -cover -run=^TestWithReportMissed$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithReportMissed$ func TestWithReportMissed(t *testing.T) { reportMissed := func(reporter *Reporter, key string) {} @@ -194,7 +194,7 @@ func TestWithReportMissed(t *testing.T) { } } -// go test -v -cover -run=^TestWithReportHit$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithReportHit$ func TestWithReportHit(t *testing.T) { reportHit := func(reporter *Reporter, key string, value interface{}) {} @@ -207,7 +207,7 @@ func TestWithReportHit(t *testing.T) { } } -// go test -v -cover -run=^TestWithReportGC$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithReportGC$ func TestWithReportGC(t *testing.T) { reportGC := func(reporter *Reporter, cost time.Duration, cleans int) {} @@ -220,7 +220,7 @@ func TestWithReportGC(t *testing.T) { } } -// go test -v -cover -run=^TestWithReportLoad$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestWithReportLoad$ func TestWithReportLoad(t *testing.T) { reportLoad := func(reporter *Reporter, key string, value interface{}, ttl time.Duration, err error) {} diff --git a/pkg/clock/clock_test.go b/pkg/clock/clock_test.go index f44b95e..aa70164 100644 --- a/pkg/clock/clock_test.go +++ b/pkg/clock/clock_test.go @@ -43,7 +43,7 @@ func BenchmarkClockNow(b *testing.B) { } } -// go test -v -cover -run=^TestNew$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestNew$ func TestNew(t *testing.T) { var clocks []*Clock @@ -58,7 +58,7 @@ func TestNew(t *testing.T) { } } -// go test -v -cover -run=^TestClock$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestClock$ func TestClock(t *testing.T) { testClock := New() diff --git a/pkg/heap/heap_test.go b/pkg/heap/heap_test.go index f496fcd..b74556b 100644 --- a/pkg/heap/heap_test.go +++ b/pkg/heap/heap_test.go @@ -33,7 +33,7 @@ func newTestData(count int) []int { return data } -// go test -v -cover -run=^TestItem$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestItem$ func TestItem(t *testing.T) { heap := New(64) @@ -107,7 +107,7 @@ func TestItem(t *testing.T) { } } -// go test -v -cover -run=^TestHeap$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestHeap$ func TestHeap(t *testing.T) { data := newTestData(10) t.Log(data) diff --git a/pkg/singleflight/singleflight_test.go b/pkg/singleflight/singleflight_test.go index 0367194..7daa777 100644 --- a/pkg/singleflight/singleflight_test.go +++ b/pkg/singleflight/singleflight_test.go @@ -55,13 +55,13 @@ func testGroupCall(t *testing.T, group *Group, concurrency int) { wg.Wait() } -// go test -v -cover -run=^TestGroupCall$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestGroupCall$ func TestGroupCall(t *testing.T) { group := NewGroup(128) testGroupCall(t, group, 100000) } -// go test -v -cover -run=^TestGroupCallMultiKey$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestGroupCallMultiKey$ func TestGroupCallMultiKey(t *testing.T) { group := NewGroup(128) @@ -78,7 +78,7 @@ func TestGroupCallMultiKey(t *testing.T) { wg.Wait() } -// go test -v -cover -run=^TestGroupDelete$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestGroupDelete$ func TestGroupDelete(t *testing.T) { group := NewGroup(128) @@ -114,7 +114,7 @@ func TestGroupDelete(t *testing.T) { } } -// go test -v -cover -run=^TestGroupReset$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestGroupReset$ func TestGroupReset(t *testing.T) { group := NewGroup(128) diff --git a/pkg/task/task_test.go b/pkg/task/task_test.go index c074c04..3b5fc3d 100644 --- a/pkg/task/task_test.go +++ b/pkg/task/task_test.go @@ -27,7 +27,7 @@ type testEntry struct { value string } -// go test -v -cover -run=^TestTickerTaskRun$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestTickerTaskRun$ func TestTickerTaskRun(t *testing.T) { before := testEntry{key: "before_key", value: "before_value"} fn := testEntry{key: "task_key", value: "task_value"} diff --git a/report_test.go b/report_test.go index 607a8cf..9619ed0 100644 --- a/report_test.go +++ b/report_test.go @@ -39,13 +39,13 @@ func newTestReportableCache() (*reportableCache, *Reporter) { return cache.(*reportableCache), reporter } -// go test -v -cover -run=^TestReportableCache$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReportableCache$ func TestReportableCache(t *testing.T) { cache, _ := newTestReportableCache() testCacheImplement(t, cache) } -// go test -v -cover -run=^TestReportableCacheReportMissed$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReportableCacheReportMissed$ func TestReportableCacheReportMissed(t *testing.T) { cache, reporter := newTestReportableCache() cache.Set("key", 666, NoTTL) @@ -80,7 +80,7 @@ func TestReportableCacheReportMissed(t *testing.T) { } } -// go test -v -cover -run=^TestReportableCacheReportHit$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReportableCacheReportHit$ func TestReportableCacheReportHit(t *testing.T) { cache, reporter := newTestReportableCache() cache.Set("key", 666, NoTTL) @@ -119,7 +119,7 @@ func TestReportableCacheReportHit(t *testing.T) { } } -// go test -v -cover -run=^TestReportableCacheReportGC$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReportableCacheReportGC$ func TestReportableCacheReportGC(t *testing.T) { cache, reporter := newTestReportableCache() cache.Set("key1", 1, time.Millisecond) @@ -160,7 +160,7 @@ func TestReportableCacheReportGC(t *testing.T) { } } -// go test -v -cover -run=^TestReportableCacheReportLoad$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReportableCacheReportLoad$ func TestReportableCacheReportLoad(t *testing.T) { cache, reporter := newTestReportableCache() @@ -209,7 +209,7 @@ func TestReportableCacheReportLoad(t *testing.T) { } } -// go test -v -cover -run=^TestReporterCacheName$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReporterCacheName$ func TestReporterCacheName(t *testing.T) { _, reporter := newTestReportableCache() if reporter.CacheName() != reporter.conf.cacheName { @@ -221,7 +221,7 @@ func TestReporterCacheName(t *testing.T) { } } -// go test -v -cover -run=^TestReporterCacheType$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReporterCacheType$ func TestReporterCacheType(t *testing.T) { _, reporter := newTestReportableCache() if reporter.CacheType() != reporter.conf.cacheType { @@ -233,7 +233,7 @@ func TestReporterCacheType(t *testing.T) { } } -// go test -v -cover -run=^TestReporterCacheShardings$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReporterCacheShardings$ func TestReporterCacheShardings(t *testing.T) { _, reporter := newTestReportableCache() if reporter.CacheShardings() != reporter.conf.shardings { @@ -245,7 +245,7 @@ func TestReporterCacheShardings(t *testing.T) { } } -// go test -v -cover -run=^TestReporterCacheGC$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReporterCacheGC$ func TestReporterCacheGC(t *testing.T) { _, reporter := newTestReportableCache() if reporter.CacheGC() != reporter.conf.gcDuration { @@ -257,7 +257,7 @@ func TestReporterCacheGC(t *testing.T) { } } -// go test -v -cover -run=^TestReporterCacheSize$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestReporterCacheSize$ func TestReporterCacheSize(t *testing.T) { cache, reporter := newTestReportableCache() cache.Set("key1", 1, time.Millisecond) diff --git a/sharding_test.go b/sharding_test.go index 86f3f1f..71c7d22 100644 --- a/sharding_test.go +++ b/sharding_test.go @@ -30,13 +30,13 @@ func newTestShardingCache() *shardingCache { return newShardingCache(conf, newStandardCache).(*shardingCache) } -// go test -v -cover -run=^TestShardingCache$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestShardingCache$ func TestShardingCache(t *testing.T) { cache := newTestShardingCache() testCacheImplement(t, cache) } -// go test -v -cover -run=^TestShardingCacheIndex$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestShardingCacheIndex$ func TestShardingCacheIndex(t *testing.T) { cache := newTestShardingCache() diff --git a/standard_test.go b/standard_test.go index 5bb82c2..3af3b85 100644 --- a/standard_test.go +++ b/standard_test.go @@ -27,13 +27,13 @@ func newTestStandardCache() *standardCache { return newStandardCache(conf).(*standardCache) } -// go test -v -cover -run=^TestStandardCache$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestStandardCache$ func TestStandardCache(t *testing.T) { cache := newTestStandardCache() testCacheImplement(t, cache) } -// go test -v -cover -run=^TestStandardCacheEvict$ +// go test -v -cover -count=1 -test.cpu=1 -run=^TestStandardCacheEvict$ func TestStandardCacheEvict(t *testing.T) { cache := newTestStandardCache()