Skip to content

Tags: Nerzal/goache

Tags

v0.1.0

Toggle v0.1.0's commit message
goache v0.1.0 — first release

A sharded, generic, dependency-free cache for Go, plus a second unsharded
implementation for processes pinned to one core.

Cache[K, V] routes keys to one of N independently-locked shards. At 24 threads
and 100,000 entries a concurrent Get costs 4.58 ns/op against go-cache 36.61.

SingleCoreCache[K, V] (NewSingleCore) is for GOMAXPROCS=1, where sharding buys
nothing. At one core it is the fastest of seven measured caches in all eight
benchmark categories.

Set, SetWithTTL, SetMany, Get, Delete, DeleteMany, Clear, Len, Purge, with
WithCapacity, WithMaxSize (CLOCK eviction) and WithShardCount.

Requires Go 1.25. No dependencies.