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/gospackler/ttlcache"
)
func main () {
cache := ttlcache.New(time.Second)
// ttlcache stores byte slice values.
cache.Set("key", []byte("value"))
value, exists := cache.Get("key")
count := cache.Count()
}