A collection of a few Go packages for Key Value storage like caches.
go get github.com/saintwish/kv
All of the packages of generic support for safety. Some of the packages use the swiss map instead of the default Go map.
-
kv1- A Key Value sharded cache with time expiration. Usesswissmap. -
kv1s- A Key Value sharded cache without any auto eviction. Usesswissmap. -
kv2- A Key Value sharded cache with a max size and automated eviction when the map gets full. I wouldn't use it because that eviction method is flawed. Usesswissmap. -
kvswiss- A Key Value cache that is non-sharded using theswissmap as it's backend. -
kvmap- A Key Value sharded cache using vanilla Go map with no auto eviction. -
ccmap- A concurrent safe default Go map without sharding. -
stack- A last in, first out stack implementation without concurrency support. Used in thekv2package.
You can run benchmarks in the "main" using go test -bench . -benchmem. There's some packages missing from the benchmarks however because they should be the same as kv1 one basically except for different eviction methods.
The swiss map and this package are licensed with Apache-2.0