An in-memory Key Value Store with Expiration
$ go get -u github.com/mzampetakis/kvse
New() DataStore
New
returns a new instance of aDataStore
.
Set(key string, value interface, lifespan time.Duration)
Set
adds thevalue
to the data store associated tokey
and will be deleted afterlifespan
duration.
Get(key string) interface{}, bool
Get
retrieves the value associated tokey
, and a boolean variable if found.
Has(key string) bool
Has
returns abool
based on whether or notkey
exists in the data store.
go test
go test -bench=.