go-programming-tour-book / cache-example Goto Github PK
View Code? Open in Web Editor NEW《Go 语言编程之旅:一起用 Go 做项目》 第五章:进程内缓存
Home Page: https://studygolang.com
License: MIT License
《Go 语言编程之旅:一起用 Go 做项目》 第五章:进程内缓存
Home Page: https://studygolang.com
License: MIT License
老师请问一下, 为什么我按照书里面的命令安装bigCache 一直404, 不加版本号的话一直下载的是 1.2.1 版本, 加了 -u 参数也是, 加版本号完全下载不了最新的, 2.2.0 也不行, 用的七牛云的国内代理, 难道一定要科学上网才行吗?
如題所述,fast/shard.go好像怪怪的,是不是要用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:
container/list.(*List).move()
/usr/local/go/src/container/list/list.go:131 +0x3e6
container/list.(*List).MoveToBack()
/usr/local/go/src/container/list/list.go:201 +0x20d
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
Goroutine 112 (running) created at:
test.BenchmarkT()
/home/runner/test/main_test.go:16 +0xc3
testing.(*B).runN()
/usr/local/go/src/testing/benchmark.go:191 +0x1b4
testing.(*B).launch()
/usr/local/go/src/testing/benchmark.go:321 +0x15c
Goroutine 58 (finished) created at:
test.BenchmarkT()
/home/runner/test/main_test.go:16 +0xc3
testing.(*B).runN()
/usr/local/go/src/testing/benchmark.go:191 +0x1b4
testing.(*B).launch()
/usr/local/go/src/testing/benchmark.go:321 +0x15c
==================
==================
WARNING: DATA RACE
Read at 0x00c000148248 by goroutine 67:
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 0x00c000148248 by goroutine 51:
[failed to restore the stack]
Goroutine 67 (running) created at:
test.BenchmarkT()
/home/runner/test/main_test.go:16 +0xc3
testing.(*B).runN()
/usr/local/go/src/testing/benchmark.go:191 +0x1b4
testing.(*B).launch()
/usr/local/go/src/testing/benchmark.go:321 +0x15c
Goroutine 51 (finished) created at:
test.BenchmarkT()
/home/runner/test/main_test.go:16 +0xc3
testing.(*B).runN()
/usr/local/go/src/testing/benchmark.go:191 +0x1b4
testing.(*B).launch()
/usr/local/go/src/testing/benchmark.go:321 +0x15c
........略
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.