Versions in this module Expand all Collapse all v0 v0.1.0 May 2, 2026 Changes in this version + var ErrInvalidSize = errors.New("threadsafecache: size must be > 0") + type Cache struct + func New[T any](size int, ttl time.Duration, opts ...Option[T]) (*Cache[T], error) + func (c *Cache[T]) Get(key string) (T, bool) + func (c *Cache[T]) Len() int + func (c *Cache[T]) Purge() + func (c *Cache[T]) Remove(key string) + func (c *Cache[T]) Set(key string, value T) + type Entry struct + CreatedAt time.Time + Value T + type Option func(*Cache[T]) + func WithClock[T any](now func() time.Time) Option[T]