Konstantin8105 / SimpleTTL

Simple TTL on golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimpleTTL

Coverage Status Build Status Go Report Card GitHub license GoDoc

Simple TTL on golang for map[string]interface{}, so keys is string and values is something.

See more detail: https://en.wikipedia.org/wiki/Time_to_live

Minimal example of using:

func main(){
	cache := simplettl.NewCache(2 * time.Second)
	key := "foo"
	value := "bar"
	cache.Add(key, value, time.Second)
	if r, ok := cache.Get(key); ok {
		fmt.Printf("Value for key %v is %v",key,r)
	}
}

About

Simple TTL on golang

License:MIT License


Languages

Language:Go 100.0%