ttlmap

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEntry = errors.New("no such entry")
)

Functions

This section is empty.

Types

type Cache

type Cache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any]() *Cache[T]

func (*Cache[T]) Del

func (c *Cache[T]) Del(key string) (T, bool)

func (*Cache[T]) Get

func (c *Cache[T]) Get(key string) (T, error)

func (*Cache[T]) GetDel

func (c *Cache[T]) GetDel(key string) (T, error)

like Get, but will delete key if invalid

func (*Cache[T]) Set

func (c *Cache[T]) Set(key string, val T)

func (*Cache[T]) SetWithTTL

func (c *Cache[T]) SetWithTTL(key string, val T, ttl time.Duration)

Jump to

Keyboard shortcuts

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