Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 467 Bytes

README.md

File metadata and controls

18 lines (16 loc) · 467 Bytes

ttlmap

Efficient concurrent map with TTL support. See the documentation for more information.

ttlmap := New[string, string](time.Hour, time.Minute)
ttlmap.Store("key", "value")

val, ok := ttlmap.Load("key", "value")
val, ok := ttlmap.LoadOrStore("key", "value")
val, ok := ttlmap.LoadAndDelete("key")
ttlmap.Delete("key")
ttlmap.Range(func(key string, value string) bool {
	fmt.Println(key)
	return true
})