type Cache[K, V any] struct { // contains filtered or unexported fields }
func (c *Cache[K, V]) Get(k *K, new func() (*V, error), check func(*V) bool) (*V, error)
Get returns the result of new, for an associated key k.
If Get was called with k before and didn't return an error, Get may return the same value it returned from the previous call if check returns true on it. If check returns false, Get will call new again and return the result.
The cache is evicted some time after k becomes unreachable.