TTLCache is a minimal wrapper over a map of strings to a slice of strings in golang, entries of which are
- Thread-safe
- Auto-Expiring after a certain time
Auto-Extending expiration onGet
s
import (
"time"
"github.com/linki/ttlcache"
)
func main () {
cache := ttlcache.NewCache(time.Second)
cache.Set("key", "value")
value, exists := cache.Get("key")
count := cache.Count()
}