cache

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a thread-safe in-memory key-value store with optional per-item TTL.

func New

func New() *Cache

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the value for the given key.

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

Get returns the value for the given key, or nil if not found or expired.

func (*Cache) Put

func (c *Cache) Put(key string, value interface{}, ttl time.Duration)

Put stores a value under the given key. A zero ttl means no expiration.

Jump to

Keyboard shortcuts

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