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