cache

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 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 interface {
	// Get a value from the cache and return true if found, any is the value if found and nil if no error.
	Get(key string) (bool, any, error)

	// Set a value into the cache with a cache expiration.
	Set(key string, val any, expires time.Duration) error

	// Hits returns the number of times a key has been accessed.
	Hits(key string) (bool, int)

	// Expire will expire a key in the cache.
	Expire(key string) (bool, error)

	// Close will shutdown the cache.
	Close() error
}

func NewInMemory

func NewInMemory(parent context.Context, expiryCheck time.Duration) Cache

New returns a new Cache implementation

Jump to

Keyboard shortcuts

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