cache 

different cache algorithms implementation in golang
go get git.sr.ht/~xn/cache
// example: LRU
lru := cache.NewLRU(1000)
lru.Set(1, 10)
If you need only specific cache algorithm, you can import it without additional dependencies:
go get git.sr.ht/~xn/cache/lfu
lfuCache := lfu.New(1000)
lfuCache.Set(1, 10)
status
implemented
tests
total: (statements) 96.0%
benchmarks
goos: linux
goarch: amd64
pkg: git.sr.ht/~xn/cache/lfu
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
BenchmarkSet-8 5137729 293.8 ns/op 47 B/op 2 allocs/op
BenchmarkSetX2-8 36928 120980 ns/op 51 B/op 3 allocs/op
BenchmarkGet-8 8728536 152.3 ns/op 0 B/op 0 allocs/op
BenchmarkHas-8 17306770 89.02 ns/op 0 B/op 0 allocs/op
BenchmarkRemove-8 9493314 233.2 ns/op 0 B/op 0 allocs/op
BenchmarkPurge-8 14232 175344 ns/op 909389 B/op 3 allocs/op
goos: linux
goarch: amd64
pkg: git.sr.ht/~xn/cache/lru
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
BenchmarkSet-8 4158920 297.3 ns/op 47 B/op 2 allocs/op
BenchmarkSetX2-8 38054 123251 ns/op 50 B/op 3 allocs/op
BenchmarkGet-8 6358285 223.5 ns/op 0 B/op 0 allocs/op
BenchmarkHas-8 16789678 85.98 ns/op 0 B/op 0 allocs/op
BenchmarkRemove-8 9418458 228.6 ns/op 0 B/op 0 allocs/op
BenchmarkPurge-8 14974 234563 ns/op 909389 B/op 3 allocs/op
goos: linux
goarch: amd64
pkg: git.sr.ht/~xn/cache/tlru
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
BenchmarkSet-8 3922689 316.2 ns/op 47 B/op 2 allocs/op
BenchmarkSetX2-8 38558 124703 ns/op 50 B/op 3 allocs/op
BenchmarkGet-8 5020369 232.1 ns/op 0 B/op 0 allocs/op
BenchmarkHas-8 14243359 95.20 ns/op 0 B/op 0 allocs/op
BenchmarkRemove-8 8639568 143.2 ns/op 0 B/op 0 allocs/op
BenchmarkPurge-8 10000 186508 ns/op 458824 B/op 3 allocs/op