cache-example
cache-example copied to clipboard
《Go 语言编程之旅:一起用 Go 做项目》 第五章:进程内缓存
如題所述,[fast/shard.go](https://github.com/go-programming-tour-book/cache-example/blob/1c0f4ba750a00e289d619f86716677fc91c582f2/fast/shard.go#L58)好像怪怪的,是不是要用Lock而不是RLock?還是我誤解了什麼? ``` WARNING: DATA RACE Read at 0x00c00014ed88 by goroutine 112: container/list.(*List).MoveToBack() /usr/local/go/src/container/list/list.go:197 +0x4b8 test/fast.(*cacheShard).get() /home/runner/test/fast/shard.go:63 +0x12b test/fast.(*fastCache).Get() /home/runner/test/fast/cache.go:32 +0xd8 test.BenchmarkT.func2() /home/runner/test/main_test.go:17 +0x90 Previous write at 0x00c00014ed88 by goroutine 58:...