hotcache

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 3 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHotCacheDataNotFound = errors.New("hot cache data not found")

Functions

This section is empty.

Types

type HotCache

type HotCache[T any] interface {
	// Get a value from the cache
	Get(ctx context.Context, key string) (*T, error)

	// Delete a value from the cache
	Delete(ctx context.Context, key string) error

	// Set a value in the cache
	Set(ctx context.Context, key string, value *T, expiry time.Duration) error

	// Increment a value in the cache
	Increment(ctx context.Context, key string, value int64) error

	// Increment by one a value in the cache
	//
	// This can be faster than Increment(ctx, key, 1)
	IncrementOne(ctx context.Context, key string) error

	// Checks if a value exists in the cache
	Exists(ctx context.Context, key string) (bool, error)

	// Checks the expiry of a value in the cache
	Expiry(ctx context.Context, key string) (time.Duration, error)
}

A HotCache represents a cache that is hot (meaning that it is used often)

Eureka provides a redis cache for you, but you can implement your own if you want

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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