Registry / utility / dgraph-io-ristretto

dgraph-io-ristretto

JSON →
library0.2.0gogounverified

Ristretto is a fast, fixed size, in-memory cache with a dual focus on throughput and hit ratio performance.

go get github.com/dgraph-io/ristretto
INSTALL
IMPORT
SIG · DGRAPH-IO-RISTRETT
D
dgraph-io-ristretto
utilitygov0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ristretto
github.com/dgraph-io/ristretto

Create a Ristretto cache, set a key-value pair, and retrieve it.

package main import ( "fmt" "github.com/dgraph-io/ristretto" ) func main() { cache, err := ristretto.NewCache(&ristretto.Config{ NumCounters: 1e7, MaxCost: 1 << 30, BufferItems: 64, }) if err != nil { panic(err) } cache.Set("key", "value", 1) cache.Wait() value, found := cache.Get("key") if found { fmt.Println(value) } }
Debug
Known issues
gotchaRistretto uses a cost-based eviction policy; setting incorrect costs can lead to unexpected evictions.
fix
Ensure the cost parameter in Set() reflects the actual memory usage of the value.
affects: all
Upgrade
Version history
0.2.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
dgraph-io-ristretto — go get dgraph-io-ristretto · libregistry