Categorygithub.com/dc0d/tinykv
modulepackage
4.0.1+incompatible
Repository: https://github.com/dc0d/tinykv.git
Documentation: pkg.go.dev

# README

GoDoc Go Report Card

tinykv

tiny in-memory single-app kv (cache) with explicit and sliding expiration

v4

  • Heap-based expiration strategy

Get it using:

$ go get gopkg.in/dc0d/tinykv.v4

v3

  • Using only string keys,
  • Simplifying the interface,

Get it using:

$ go get gopkg.in/dc0d/tinykv.v3

v2

Get it using:

$ go get gopkg.in/dc0d/tinykv.v2

v1

Get it using:

$ go get gopkg.in/dc0d/tinykv.v1

Benchmarks:

$ go test -bench=.
BenchmarkGetNoValue-8          	20000000	        72.6 ns/op
BenchmarkGetValue-8            	20000000	        78.3 ns/op
BenchmarkGetSlidingTimeout-8   	10000000	       128 ns/op
BenchmarkPutOne-8              	10000000	       219 ns/op
BenchmarkPutN-8                	 2000000	       814 ns/op
BenchmarkPutExpire-8           	 2000000	       882 ns/op
BenchmarkCASTrue-8             	 5000000	       268 ns/op
BenchmarkCASFalse-8            	10000000	       260 ns/op

# Packages

No description provided by the author

# Functions

CAS for performing a compare and swap.
ExpiresAfter entry will expire after this time.
IsSliding sets if the entry would get expired in a sliding manner.
New creates a new *store, onExpire is for notification (must be fast).

# Variables

errors.

# Interfaces

KV is a registry for values (like/is a concurrent map) with timeout and sliding timeout.

# Type aliases

PutOption extra options for put.