hotcache

package
v0.0.0-...-4d5f9bd Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 3 Imported by: 0

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