like
https://github.com/Code-Hex/go-generics-cache
https://github.com/jellydator/ttlcache
https://github.com/mdaliyan/icache
New a CacheT[V] / CacheKvT[K,V] operator class
type CacheT[V any] interface {
Has(key string) bool
Get(key string) (V, bool)
Set(key string, val V, ttl time.Duration) (err error)
Del(key string) error
}
type CacheKvT[K comparable, V any] interface {
Has(key K) bool
Get(key K) (V, bool)
Set(key K, val V, ttl time.Duration) (err error)
Del(key K) error
}
like
https://github.com/Code-Hex/go-generics-cache
https://github.com/jellydator/ttlcache
https://github.com/mdaliyan/icache
New a CacheT[V] / CacheKvT[K,V] operator class