memory

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound indicates the requested key does not exist in the cache
	ErrKeyNotFound = errors.New("key not found")

	// ErrUnexpectedType occurs when attempting to retrieve data with unexpected type
	ErrUnexpectedType = errors.New("unknown data type")
)

Functions

func NewCache

func NewCache(defaultExpiration, cleanupInterval time.Duration) *cache

NewCache creates an in-memory cache instance with configurable expiration. defaultExpiration: default TTL for cache entries (use time.Duration(0) for no expiration) cleanupInterval: interval for automatic removal of expired entries (use time.Duration(0) to disable)

Types

This section is empty.

Jump to

Keyboard shortcuts

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