cache

package
v10.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cache provides an in-memory TTL/LRU cache with optional OTel metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](opts ...Option) *Cache[K, V]

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(key K)

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, bool)

func (*Cache[K, V]) Len

func (c *Cache[K, V]) Len() int

func (*Cache[K, V]) Prune

func (c *Cache[K, V]) Prune() int

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, value V)

type Option

type Option func(*config)

func MaxSize

func MaxSize(n int) Option

func Name

func Name(s string) Option

func TTL

func TTL(d time.Duration) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL