inmem

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = cache.ErrNotFound

ErrNotFound is an alias for cache.ErrNotFound so existing callers using inmem.ErrNotFound keep working.

Functions

This section is empty.

Types

type Cache

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

func New

func New[K ~string, V any]() *Cache[K, V]

func (*Cache[K, V]) Add added in v0.11.0

func (c *Cache[K, V]) Add(key K, value V, ttl time.Duration) (bool, error)

func (*Cache[K, V]) Get

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

func (*Cache[K, V]) Keys

func (c *Cache[K, V]) Keys(prefix K) []K

func (*Cache[K, V]) Pop

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

func (*Cache[K, V]) Remove

func (c *Cache[K, V]) Remove(keys ...K) error

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, value V, ttl time.Duration) error

Jump to

Keyboard shortcuts

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