cache
Install
go get -u github.com/zs5460/cache
Usage
c := cache.New(1*time.Minute)
c.Set("foo","bar")
v , exist := c.Get("foo")
if exist {
fmt.Println(v.(string))
}
c.Close()
Benchmark
goos: linux
goarch: amd64
pkg: github.com/zs5460/cache
BenchmarkNew-8 10000000 188 ns/op 368 B/op 5 allocs/op
BenchmarkGet-8 100000000 18.5 ns/op 0 B/op 0 allocs/op
BenchmarkSet-8 10000000 209 ns/op 48 B/op 2 allocs/op
BenchmarkDelete-8 1000000000 3.13 ns/op 0 B/op 0 allocs/op
License
Released under MIT license, see LICENSE for details.