generational

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_GENERATION_KEY_PREFIX = "cache.generationalcache"
	KEY_DELIMITER                 = "."
)

Variables

This section is empty.

Functions

func GetGen

func GetGen(ctx context.Context, group string) (int64, error)

func GetGenerationFromCache

func GetGenerationFromCache(ctx context.Context, c generationalInterface, group string) (int64, error)

func GetItem

func GetItem[T any](ctx context.Context, ttl time.Duration, gen int64, group string, key []string, get func(context.Context) (T, error)) (result T, err error)

func GetItemFromCache

func GetItemFromCache[T1, T2 any](ctx context.Context, c cache.TypedCache[T1], ttl time.Duration, gen int64, group string, key []string, get func(context.Context) (T2, error)) (result T2, err error)

Types

type GenerationKey

type GenerationKey = string

type KeyGenerator

type KeyGenerator = func(...string) GenerationKey

func GenerationKeyFromCache

func GenerationKeyFromCache(ctx context.Context, c generationalInterface, group string) (KeyGenerator, error)

func GetKey

func GetKey(ctx context.Context, group string, key ...string) (KeyGenerator, error)

func RollOver

func RollOver(ctx context.Context, group string, ttl time.Duration) (KeyGenerator, error)

RollOver increments the generation key in the It also returns a GenerationKey generator.

func RollOverFromCache

func RollOverFromCache(ctx context.Context, c generationalInterface, group string, ttl time.Duration) (KeyGenerator, error)

RollOverFromCache increments the generation key in the It also returns a GenerationKey.

Jump to

Keyboard shortcuts

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