Registry / utility / renekroon-ttlcache-v2

renekroon-ttlcache-v2

JSON →
library2.11.1gogounverified

Package ttlcache provides an in-memory cache with per-entry TTL (time-to-live) expiration.

go get github.com/ReneKroon/ttlcache/v2
INSTALL
IMPORT
SIG · RENEKROON-TTLCACHE
R
renekroon-ttlcache-v2
utilitygov2.11.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ttlcache
github.com/ReneKroon/ttlcache/v2

Create a TTL cache, set a key with 1-minute expiration, and retrieve it.

package main import ( "fmt" "time" "github.com/ReneKroon/ttlcache/v2" ) func main() { cache := ttlcache.NewCache() cache.Set("key", "value", time.Minute) val, _ := cache.Get("key") fmt.Println(val) }
Debug
Known issues
breakingv2 has breaking API changes from v1; the NewCache function signature changed.
fix
Use ttlcache.NewCache() instead of ttlcache.NewCache(ttlcache.WithTTL(...)).
affects: >=2.0.0
Upgrade
Version history
2.11.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
renekroon-ttlcache-v2 — go get renekroon-ttlcache-v2 · libregistry